@olane/o-lane 0.7.17 → 0.7.19
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/src/capabilities/enums/o-capability.type-enum.d.ts +1 -0
- package/dist/src/capabilities/enums/o-capability.type-enum.d.ts.map +1 -1
- package/dist/src/capabilities/enums/o-capability.type-enum.js +1 -0
- package/dist/src/capabilities/index.d.ts +2 -1
- package/dist/src/capabilities/index.d.ts.map +1 -1
- package/dist/src/capabilities/index.js +2 -1
- package/dist/src/capabilities/interfaces/{o-capability.config.d.ts → o-capability.config-interface.d.ts} +5 -4
- package/dist/src/capabilities/interfaces/o-capability.config-interface.d.ts.map +1 -0
- package/dist/src/capabilities/interfaces/o-capability.result-interface.d.ts +1 -2
- package/dist/src/capabilities/interfaces/o-capability.result-interface.d.ts.map +1 -1
- package/dist/src/capabilities/o-capability.config.d.ts +24 -0
- package/dist/src/capabilities/o-capability.config.d.ts.map +1 -0
- package/dist/src/capabilities/o-capability.config.js +25 -0
- package/dist/src/capabilities/o-capability.d.ts +9 -5
- package/dist/src/capabilities/o-capability.d.ts.map +1 -1
- package/dist/src/capabilities/o-capability.intelligence.d.ts.map +1 -1
- package/dist/src/capabilities/o-capability.intelligence.js +4 -18
- package/dist/src/capabilities/o-capability.js +4 -5
- package/dist/src/capabilities/o-capability.result.d.ts +6 -12
- package/dist/src/capabilities/o-capability.result.d.ts.map +1 -1
- package/dist/src/capabilities/o-capability.result.js +2 -10
- package/dist/src/capabilities-all/o-capability.all.d.ts +2 -3
- package/dist/src/capabilities-all/o-capability.all.d.ts.map +1 -1
- package/dist/src/capabilities-all/o-capability.all.js +6 -8
- package/dist/src/capabilities-configure/interfaces/o-capability.configure-config.d.ts +2 -2
- package/dist/src/capabilities-configure/interfaces/o-capability.configure-config.d.ts.map +1 -1
- package/dist/src/capabilities-configure/o-capability.configure.d.ts +0 -15
- package/dist/src/capabilities-configure/o-capability.configure.d.ts.map +1 -1
- package/dist/src/capabilities-configure/o-capability.configure.js +61 -47
- package/dist/src/capabilities-evaluate/o-capability.evaluate.d.ts +1 -0
- package/dist/src/capabilities-evaluate/o-capability.evaluate.d.ts.map +1 -1
- package/dist/src/capabilities-evaluate/o-capability.evaluate.js +17 -2
- package/dist/src/capabilities-execute/execute.capability.d.ts +13 -0
- package/dist/src/capabilities-execute/execute.capability.d.ts.map +1 -0
- package/dist/src/capabilities-execute/execute.capability.js +111 -0
- package/dist/src/capabilities-execute/interfaces/o-capability.configure-config.d.ts +8 -0
- package/dist/src/capabilities-execute/interfaces/o-capability.configure-config.d.ts.map +1 -0
- package/dist/src/capabilities-multiple-step/interfaces/o-capability.multiple-step-config.d.ts +1 -1
- package/dist/src/capabilities-multiple-step/interfaces/o-capability.multiple-step-config.d.ts.map +1 -1
- package/dist/src/capabilities-multiple-step/o-capability.multiple-step.d.ts.map +1 -1
- package/dist/src/capabilities-multiple-step/o-capability.multiple-step.js +0 -1
- package/dist/src/capabilities-search/interfaces/o-capability.search-config.d.ts +1 -1
- package/dist/src/capabilities-search/interfaces/o-capability.search-config.d.ts.map +1 -1
- package/dist/src/capabilities-search/o-capability.search.d.ts.map +1 -1
- package/dist/src/capabilities-search/o-capability.search.js +0 -4
- package/dist/src/index.d.ts +1 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -2
- package/dist/src/interfaces/o-lane.config.d.ts +3 -0
- package/dist/src/interfaces/o-lane.config.d.ts.map +1 -1
- package/dist/src/o-lane.d.ts +6 -12
- package/dist/src/o-lane.d.ts.map +1 -1
- package/dist/src/o-lane.js +23 -180
- package/dist/src/o-lane.mixin.d.ts.map +1 -1
- package/dist/src/o-lane.mixin.js +9 -5
- package/dist/src/prompts/agent.prompt.d.ts +1 -12
- package/dist/src/prompts/agent.prompt.d.ts.map +1 -1
- package/dist/src/prompts/agent.prompt.js +80 -138
- package/dist/src/prompts/configure.prompt.d.ts +1 -8
- package/dist/src/prompts/configure.prompt.d.ts.map +1 -1
- package/dist/src/prompts/configure.prompt.js +68 -47
- package/dist/src/prompts/execute.prompt.d.ts +9 -0
- package/dist/src/prompts/execute.prompt.d.ts.map +1 -0
- package/dist/src/prompts/execute.prompt.js +47 -0
- package/dist/src/prompts/index.d.ts +3 -0
- package/dist/src/prompts/index.d.ts.map +1 -0
- package/dist/src/prompts/index.js +2 -0
- package/dist/src/prompts/interfaces/o-prompt.config.d.ts +8 -0
- package/dist/src/prompts/interfaces/o-prompt.config.d.ts.map +1 -0
- package/dist/src/prompts/interfaces/o-prompt.config.js +1 -0
- package/dist/src/prompts/o-prompt.d.ts +36 -0
- package/dist/src/prompts/o-prompt.d.ts.map +1 -0
- package/dist/src/prompts/o-prompt.js +92 -0
- package/dist/src/storage/default.prompt-loader.d.ts +14 -0
- package/dist/src/storage/default.prompt-loader.d.ts.map +1 -0
- package/dist/src/storage/default.prompt-loader.js +34 -0
- package/dist/src/storage/index.d.ts +1 -3
- package/dist/src/storage/index.d.ts.map +1 -1
- package/dist/src/storage/index.js +1 -5
- package/dist/src/storage/o-lane.storage-manager.d.ts +71 -0
- package/dist/src/storage/o-lane.storage-manager.d.ts.map +1 -0
- package/dist/src/storage/o-lane.storage-manager.js +208 -0
- package/dist/src/storage/prompt-loader.d.ts +10 -28
- package/dist/src/storage/prompt-loader.d.ts.map +1 -1
- package/dist/src/storage/prompt-loader.js +9 -112
- package/dist/test/index.d.ts +1 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +2 -0
- package/package.json +12 -10
- package/dist/src/capabilities/interfaces/o-capability.config.d.ts.map +0 -1
- package/dist/src/capabilities-task/interfaces/o-capability.task-config.d.ts +0 -16
- package/dist/src/capabilities-task/interfaces/o-capability.task-config.d.ts.map +0 -1
- package/dist/src/capabilities-task/o-capability.task-result.d.ts +0 -5
- package/dist/src/capabilities-task/o-capability.task-result.d.ts.map +0 -1
- package/dist/src/capabilities-task/o-capability.task-result.js +0 -3
- package/dist/src/capabilities-task/o-capability.task.d.ts +0 -20
- package/dist/src/capabilities-task/o-capability.task.d.ts.map +0 -1
- package/dist/src/capabilities-task/o-capability.task.js +0 -124
- package/dist/src/storage/prompt-schema.d.ts +0 -42
- package/dist/src/storage/prompt-schema.d.ts.map +0 -1
- package/dist/src/storage/prompt-schema.js +0 -29
- package/dist/src/storage/prompt-seeder.d.ts +0 -42
- package/dist/src/storage/prompt-seeder.d.ts.map +0 -1
- package/dist/src/storage/prompt-seeder.js +0 -141
- package/dist/src/storage/prompt-storage-provider.tool.d.ts +0 -99
- package/dist/src/storage/prompt-storage-provider.tool.d.ts.map +0 -1
- package/dist/src/storage/prompt-storage-provider.tool.js +0 -320
- package/dist/test/prompt-seeder.spec.d.ts +0 -2
- package/dist/test/prompt-seeder.spec.d.ts.map +0 -1
- package/dist/test/prompt-seeder.spec.js +0 -256
- package/dist/test/prompt-storage-provider.spec.d.ts +0 -2
- package/dist/test/prompt-storage-provider.spec.d.ts.map +0 -1
- package/dist/test/prompt-storage-provider.spec.js +0 -457
- /package/dist/src/capabilities/interfaces/{o-capability.config.js → o-capability.config-interface.js} +0 -0
- /package/dist/src/{capabilities-task/interfaces/o-capability.task-config.js → capabilities-execute/interfaces/o-capability.configure-config.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-lane",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@eslint/eslintrc": "^3.3.1",
|
|
38
38
|
"@eslint/js": "^9.29.0",
|
|
39
|
-
"@olane/o-test": "0.7.
|
|
39
|
+
"@olane/o-test": "0.7.19",
|
|
40
40
|
"@tsconfig/node20": "^20.1.6",
|
|
41
|
+
"@types/handlebars": "^4.1.0",
|
|
41
42
|
"@types/jest": "^30.0.0",
|
|
42
43
|
"@typescript-eslint/eslint-plugin": "^8.34.1",
|
|
43
44
|
"@typescript-eslint/parser": "^8.34.1",
|
|
@@ -56,14 +57,15 @@
|
|
|
56
57
|
"typescript": "5.4.5"
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
|
-
"@olane/o-config": "0.7.
|
|
60
|
-
"@olane/o-core": "0.7.
|
|
61
|
-
"@olane/o-node": "0.7.
|
|
62
|
-
"@olane/o-protocol": "0.7.
|
|
63
|
-
"@olane/o-storage": "0.7.
|
|
64
|
-
"@olane/o-tool": "0.7.
|
|
60
|
+
"@olane/o-config": "0.7.19",
|
|
61
|
+
"@olane/o-core": "0.7.19",
|
|
62
|
+
"@olane/o-node": "0.7.19",
|
|
63
|
+
"@olane/o-protocol": "0.7.19",
|
|
64
|
+
"@olane/o-storage": "0.7.19",
|
|
65
|
+
"@olane/o-tool": "0.7.19",
|
|
65
66
|
"debug": "^4.4.1",
|
|
66
|
-
"dotenv": "^16.5.0"
|
|
67
|
+
"dotenv": "^16.5.0",
|
|
68
|
+
"handlebars": "^4.7.8"
|
|
67
69
|
},
|
|
68
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "956ef7a726e5ac2efb7028ffca707ec1cf6ea131"
|
|
69
71
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"o-capability.config.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/interfaces/o-capability.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAEhC,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { oCapabilityConfig } from '../../capabilities/interfaces/o-capability.config.js';
|
|
2
|
-
export interface oCapabilityTaskConfig extends oCapabilityConfig {
|
|
3
|
-
params: {
|
|
4
|
-
task: {
|
|
5
|
-
address: string;
|
|
6
|
-
payload: {
|
|
7
|
-
method: string;
|
|
8
|
-
params: {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
summary: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=o-capability.task-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"o-capability.task-config.d.ts","sourceRoot":"","sources":["../../../../src/capabilities-task/interfaces/o-capability.task-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AAEzF,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE;gBACP,MAAM,EAAE,MAAM,CAAC;gBACf,MAAM,EAAE;oBAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;iBAAE,CAAC;aAChC,CAAC;SACH,CAAC;QACF,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"o-capability.task-result.d.ts","sourceRoot":"","sources":["../../../src/capabilities-task/o-capability.task-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,qBAAa,qBAAsB,SAAQ,iBAAiB;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { oCapability } from '../capabilities/o-capability.js';
|
|
2
|
-
import { oCapabilityTaskConfig } from './interfaces/o-capability.task-config.js';
|
|
3
|
-
import { oCapabilityType } from '../capabilities/enums/o-capability.type-enum.js';
|
|
4
|
-
import { oCapabilityTaskResult } from './o-capability.task-result.js';
|
|
5
|
-
export declare class oCapabilityTask extends oCapability {
|
|
6
|
-
config: oCapabilityTaskConfig;
|
|
7
|
-
get task(): {
|
|
8
|
-
address: string;
|
|
9
|
-
payload: {
|
|
10
|
-
method: string;
|
|
11
|
-
params: {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
get type(): oCapabilityType;
|
|
17
|
-
static get type(): oCapabilityType;
|
|
18
|
-
run(): Promise<oCapabilityTaskResult>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=o-capability.task.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"o-capability.task.d.ts","sourceRoot":"","sources":["../../../src/capabilities-task/o-capability.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,qBAAa,eAAgB,SAAQ,WAAW;IACvC,MAAM,EAAG,qBAAqB,CAAC;IAEtC,IAAI,IAAI;;;;;;;;MAEP;IAED,IAAI,IAAI,IAAI,eAAe,CAE1B;IAED,MAAM,KAAK,IAAI,oBAEd;IAWK,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC;CA6H5C"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { oAddress, oError, oErrorCodes } from '@olane/o-core';
|
|
2
|
-
import { oCapability } from '../capabilities/o-capability.js';
|
|
3
|
-
import { oCapabilityType } from '../capabilities/enums/o-capability.type-enum.js';
|
|
4
|
-
import { oCapabilityTaskResult } from './o-capability.task-result.js';
|
|
5
|
-
export class oCapabilityTask extends oCapability {
|
|
6
|
-
get task() {
|
|
7
|
-
return this.config.params.task;
|
|
8
|
-
}
|
|
9
|
-
get type() {
|
|
10
|
-
return oCapabilityType.TASK;
|
|
11
|
-
}
|
|
12
|
-
static get type() {
|
|
13
|
-
return oCapabilityType.TASK;
|
|
14
|
-
}
|
|
15
|
-
// async doConfigure(): Promise<oCapabilityTaskResult> {
|
|
16
|
-
// const c = new oCapabilityConfigure({
|
|
17
|
-
// intent: this.intent,
|
|
18
|
-
// params: {}
|
|
19
|
-
// node: this.node,
|
|
20
|
-
// });
|
|
21
|
-
// return c.run();
|
|
22
|
-
// }
|
|
23
|
-
async run() {
|
|
24
|
-
try {
|
|
25
|
-
// do MCP handshake to get the method + parameters + dependencies
|
|
26
|
-
this.logger.debug('Running task: ', this.config);
|
|
27
|
-
// Check if we're in replay mode
|
|
28
|
-
if (this.config.isReplay) {
|
|
29
|
-
this.logger.debug('Task is being replayed - re-executing to restore state');
|
|
30
|
-
}
|
|
31
|
-
const { task } = this.config.params;
|
|
32
|
-
this.logger.debug('Task to do: ', task);
|
|
33
|
-
if (!task || !task.address) {
|
|
34
|
-
throw new oError(oErrorCodes.NOT_CONFIGURED, 'Failed to configure the tool use');
|
|
35
|
-
}
|
|
36
|
-
const params = task.payload?.params;
|
|
37
|
-
// params = await ObjectUtils.allKeyValues(params, async (key, val) => {
|
|
38
|
-
// let value = val;
|
|
39
|
-
// if (!oUsePlan.hasOlaneAddress(value)) {
|
|
40
|
-
// return value;
|
|
41
|
-
// }
|
|
42
|
-
// // extract the addresses & process them if LFS is needed
|
|
43
|
-
// this.logger.debug('Has olane address: ', value);
|
|
44
|
-
// const addresses = oUsePlan.extractAddresses(value);
|
|
45
|
-
// for (const address of addresses) {
|
|
46
|
-
// const largeDataResponse = await this.node.use(new oAddress(address));
|
|
47
|
-
// this.logger.debug(
|
|
48
|
-
// 'Large data response: ',
|
|
49
|
-
// largeDataResponse.result.data,
|
|
50
|
-
// );
|
|
51
|
-
// value = value.replace(
|
|
52
|
-
// address,
|
|
53
|
-
// (largeDataResponse.result.data as any)?.value || 'unknown value',
|
|
54
|
-
// );
|
|
55
|
-
// this.logger.debug('Updated the value with LFS value: ', value);
|
|
56
|
-
// }
|
|
57
|
-
// return value;
|
|
58
|
-
// });
|
|
59
|
-
// Request approval before executing the task
|
|
60
|
-
try {
|
|
61
|
-
const approvalResponse = await this.node.use(new oAddress('o://approval'), {
|
|
62
|
-
method: 'request_approval',
|
|
63
|
-
params: {
|
|
64
|
-
toolAddress: task.address,
|
|
65
|
-
method: task.payload?.method,
|
|
66
|
-
params: params,
|
|
67
|
-
intent: this.config.intent,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
const approved = approvalResponse.result.data?.approved;
|
|
71
|
-
if (!approved) {
|
|
72
|
-
const decision = approvalResponse.result.data?.decision || 'denied';
|
|
73
|
-
this.logger.warn(`Task execution denied by approval system: ${decision}`);
|
|
74
|
-
throw new oError(oErrorCodes.NOT_AUTHORIZED, `Action denied by approval system: ${decision}`);
|
|
75
|
-
}
|
|
76
|
-
this.logger.debug('Task approved, proceeding with execution');
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
// If approval service is not available, log warning and continue
|
|
80
|
-
// This ensures backward compatibility
|
|
81
|
-
if (error.message?.includes('No route found')) {
|
|
82
|
-
this.logger.warn('Approval service not available, proceeding without approval check');
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const response = await this.node.use(new oAddress(task.address), {
|
|
89
|
-
method: task.payload?.method,
|
|
90
|
-
params: params,
|
|
91
|
-
});
|
|
92
|
-
// if (this.config.onChunk) {
|
|
93
|
-
// this.config.onChunk(response);
|
|
94
|
-
// }
|
|
95
|
-
// Check if the tool response contains _save flag
|
|
96
|
-
const shouldPersist = response.result?.data?._save === true;
|
|
97
|
-
if (shouldPersist) {
|
|
98
|
-
this.logger.debug('Tool response contains _save flag - lane will be persisted to config');
|
|
99
|
-
}
|
|
100
|
-
return new oCapabilityTaskResult({
|
|
101
|
-
result: `Tool Address Use output: ${JSON.stringify(response.result, null, 2)}`,
|
|
102
|
-
humanResult: response.result.data,
|
|
103
|
-
type: oCapabilityType.EVALUATE,
|
|
104
|
-
config: this.config,
|
|
105
|
-
shouldPersist,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
this.logger.error('Error executing task capability: ', error);
|
|
110
|
-
if (error instanceof oError) {
|
|
111
|
-
return new oCapabilityTaskResult({
|
|
112
|
-
error: error.toString(),
|
|
113
|
-
type: oCapabilityType.EVALUATE,
|
|
114
|
-
config: this.config,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return new oCapabilityTaskResult({
|
|
118
|
-
error: error?.message || error || 'Unknown error',
|
|
119
|
-
type: oCapabilityType.EVALUATE,
|
|
120
|
-
config: this.config,
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt Storage Schema
|
|
3
|
-
*
|
|
4
|
-
* Defines the structure for storing prompt templates in PromptStorageProvider
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Prompt storage keys for the 'agent' promptId namespace
|
|
8
|
-
*/
|
|
9
|
-
export declare const PROMPT_KEYS: {
|
|
10
|
-
readonly BASE_TEMPLATE: "base_template";
|
|
11
|
-
readonly CYCLE_INSTRUCTIONS: "cycle_instructions";
|
|
12
|
-
readonly OUTPUT_INSTRUCTIONS: "output_instructions";
|
|
13
|
-
readonly CONFIGURE_INSTRUCTIONS: "configure_instructions";
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Prompt namespace IDs
|
|
17
|
-
*/
|
|
18
|
-
export declare const PROMPT_IDS: {
|
|
19
|
-
readonly AGENT: "agent";
|
|
20
|
-
readonly CUSTOM: "custom";
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Version tracking for prompt templates
|
|
24
|
-
*/
|
|
25
|
-
export declare const PROMPT_VERSION = "1.0.0";
|
|
26
|
-
/**
|
|
27
|
-
* Interface for prompt template metadata
|
|
28
|
-
*/
|
|
29
|
-
export interface PromptTemplateMetadata {
|
|
30
|
-
version: string;
|
|
31
|
-
description: string;
|
|
32
|
-
lastModified: number;
|
|
33
|
-
source: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Type for stored prompt data
|
|
37
|
-
*/
|
|
38
|
-
export interface StoredPromptTemplate {
|
|
39
|
-
content: string;
|
|
40
|
-
metadata: PromptTemplateMetadata;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=prompt-schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-schema.d.ts","sourceRoot":"","sources":["../../../src/storage/prompt-schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;CAYd,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,sBAAsB,CAAC;CAClC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt Storage Schema
|
|
3
|
-
*
|
|
4
|
-
* Defines the structure for storing prompt templates in PromptStorageProvider
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Prompt storage keys for the 'agent' promptId namespace
|
|
8
|
-
*/
|
|
9
|
-
export const PROMPT_KEYS = {
|
|
10
|
-
// Base template structure (from custom.prompt.ts)
|
|
11
|
-
BASE_TEMPLATE: 'base_template',
|
|
12
|
-
// Cycle instructions for agent workflow (from agent.prompt.ts lines 13-68)
|
|
13
|
-
CYCLE_INSTRUCTIONS: 'cycle_instructions',
|
|
14
|
-
// Output/return format instructions (from agent.prompt.ts lines 70-145)
|
|
15
|
-
OUTPUT_INSTRUCTIONS: 'output_instructions',
|
|
16
|
-
// Configure-specific instructions (from configure.prompt.ts)
|
|
17
|
-
CONFIGURE_INSTRUCTIONS: 'configure_instructions',
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Prompt namespace IDs
|
|
21
|
-
*/
|
|
22
|
-
export const PROMPT_IDS = {
|
|
23
|
-
AGENT: 'agent',
|
|
24
|
-
CUSTOM: 'custom',
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Version tracking for prompt templates
|
|
28
|
-
*/
|
|
29
|
-
export const PROMPT_VERSION = '1.0.0';
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt Seeder
|
|
3
|
-
*
|
|
4
|
-
* Seeds the PromptStorageProvider with prompt templates from prompts/ folder
|
|
5
|
-
*/
|
|
6
|
-
import { PromptStorageProvider } from './prompt-storage-provider.tool.js';
|
|
7
|
-
/**
|
|
8
|
-
* Seeds the prompt storage with default prompt templates
|
|
9
|
-
*/
|
|
10
|
-
export declare class PromptSeeder {
|
|
11
|
-
private storage;
|
|
12
|
-
constructor(storage: PromptStorageProvider);
|
|
13
|
-
/**
|
|
14
|
-
* Seed all default prompts into storage
|
|
15
|
-
*/
|
|
16
|
-
seedAll(): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Seed the base template from custom.prompt.ts
|
|
19
|
-
*/
|
|
20
|
-
private seedBaseTemplate;
|
|
21
|
-
/**
|
|
22
|
-
* Seed cycle instructions from agent.prompt.ts
|
|
23
|
-
*/
|
|
24
|
-
private seedCycleInstructions;
|
|
25
|
-
/**
|
|
26
|
-
* Seed output instructions from agent.prompt.ts
|
|
27
|
-
*/
|
|
28
|
-
private seedOutputInstructions;
|
|
29
|
-
/**
|
|
30
|
-
* Seed configure instructions from configure.prompt.ts
|
|
31
|
-
*/
|
|
32
|
-
private seedConfigureInstructions;
|
|
33
|
-
/**
|
|
34
|
-
* Check if prompts are already seeded
|
|
35
|
-
*/
|
|
36
|
-
isSeeded(): Promise<boolean>;
|
|
37
|
-
/**
|
|
38
|
-
* Clear all seeded prompts
|
|
39
|
-
*/
|
|
40
|
-
clearAll(): Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=prompt-seeder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-seeder.d.ts","sourceRoot":"","sources":["../../../src/storage/prompt-seeder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAc1E;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,qBAAqB;IAElD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAO9B;;OAEG;YACW,gBAAgB;IAqB9B;;OAEG;YACW,qBAAqB;IAqBnC;;OAEG;YACW,sBAAsB;IAqBpC;;OAEG;YACW,yBAAyB;IAqBvC;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBlC;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAQhC"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt Seeder
|
|
3
|
-
*
|
|
4
|
-
* Seeds the PromptStorageProvider with prompt templates from prompts/ folder
|
|
5
|
-
*/
|
|
6
|
-
import { PROMPT_KEYS, PROMPT_IDS, PROMPT_VERSION, } from './prompt-schema.js';
|
|
7
|
-
import { BASE_TEMPLATE_SEED } from '../prompts/custom.prompt.js';
|
|
8
|
-
import { CYCLE_INSTRUCTIONS_SEED, OUTPUT_INSTRUCTIONS_SEED, } from '../prompts/agent.prompt.js';
|
|
9
|
-
import { CONFIGURE_INSTRUCTIONS_SEED } from '../prompts/configure.prompt.js';
|
|
10
|
-
/**
|
|
11
|
-
* Seeds the prompt storage with default prompt templates
|
|
12
|
-
*/
|
|
13
|
-
export class PromptSeeder {
|
|
14
|
-
constructor(storage) {
|
|
15
|
-
this.storage = storage;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Seed all default prompts into storage
|
|
19
|
-
*/
|
|
20
|
-
async seedAll() {
|
|
21
|
-
await this.seedBaseTemplate();
|
|
22
|
-
await this.seedCycleInstructions();
|
|
23
|
-
await this.seedOutputInstructions();
|
|
24
|
-
await this.seedConfigureInstructions();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Seed the base template from custom.prompt.ts
|
|
28
|
-
*/
|
|
29
|
-
async seedBaseTemplate() {
|
|
30
|
-
const template = {
|
|
31
|
-
content: BASE_TEMPLATE_SEED,
|
|
32
|
-
metadata: {
|
|
33
|
-
version: PROMPT_VERSION,
|
|
34
|
-
description: 'Base agent prompt template structure',
|
|
35
|
-
lastModified: Date.now(),
|
|
36
|
-
source: 'prompts/custom.prompt.ts (BASE_TEMPLATE_SEED)',
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
await this.storage.use(this.storage.address, {
|
|
40
|
-
method: 'put',
|
|
41
|
-
params: {
|
|
42
|
-
promptId: PROMPT_IDS.AGENT,
|
|
43
|
-
key: PROMPT_KEYS.BASE_TEMPLATE,
|
|
44
|
-
value: template,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Seed cycle instructions from agent.prompt.ts
|
|
50
|
-
*/
|
|
51
|
-
async seedCycleInstructions() {
|
|
52
|
-
const template = {
|
|
53
|
-
content: CYCLE_INSTRUCTIONS_SEED,
|
|
54
|
-
metadata: {
|
|
55
|
-
version: PROMPT_VERSION,
|
|
56
|
-
description: 'Agent cycle workflow instructions (6 steps)',
|
|
57
|
-
lastModified: Date.now(),
|
|
58
|
-
source: 'prompts/agent.prompt.ts (CYCLE_INSTRUCTIONS_SEED)',
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
await this.storage.use(this.storage.address, {
|
|
62
|
-
method: 'put',
|
|
63
|
-
params: {
|
|
64
|
-
promptId: PROMPT_IDS.AGENT,
|
|
65
|
-
key: PROMPT_KEYS.CYCLE_INSTRUCTIONS,
|
|
66
|
-
value: template,
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Seed output instructions from agent.prompt.ts
|
|
72
|
-
*/
|
|
73
|
-
async seedOutputInstructions() {
|
|
74
|
-
const template = {
|
|
75
|
-
content: OUTPUT_INSTRUCTIONS_SEED,
|
|
76
|
-
metadata: {
|
|
77
|
-
version: PROMPT_VERSION,
|
|
78
|
-
description: 'Agent return format instructions',
|
|
79
|
-
lastModified: Date.now(),
|
|
80
|
-
source: 'prompts/agent.prompt.ts (OUTPUT_INSTRUCTIONS_SEED)',
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
await this.storage.use(this.storage.address, {
|
|
84
|
-
method: 'put',
|
|
85
|
-
params: {
|
|
86
|
-
promptId: PROMPT_IDS.AGENT,
|
|
87
|
-
key: PROMPT_KEYS.OUTPUT_INSTRUCTIONS,
|
|
88
|
-
value: template,
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Seed configure instructions from configure.prompt.ts
|
|
94
|
-
*/
|
|
95
|
-
async seedConfigureInstructions() {
|
|
96
|
-
const template = {
|
|
97
|
-
content: CONFIGURE_INSTRUCTIONS_SEED,
|
|
98
|
-
metadata: {
|
|
99
|
-
version: PROMPT_VERSION,
|
|
100
|
-
description: 'Configure capability specific instructions',
|
|
101
|
-
lastModified: Date.now(),
|
|
102
|
-
source: 'prompts/configure.prompt.ts (CONFIGURE_INSTRUCTIONS_SEED)',
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
await this.storage.use(this.storage.address, {
|
|
106
|
-
method: 'put',
|
|
107
|
-
params: {
|
|
108
|
-
promptId: PROMPT_IDS.AGENT,
|
|
109
|
-
key: PROMPT_KEYS.CONFIGURE_INSTRUCTIONS,
|
|
110
|
-
value: template,
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Check if prompts are already seeded
|
|
116
|
-
*/
|
|
117
|
-
async isSeeded() {
|
|
118
|
-
const response = await this.storage.use(this.storage.address, {
|
|
119
|
-
method: 'has',
|
|
120
|
-
params: {
|
|
121
|
-
promptId: PROMPT_IDS.AGENT,
|
|
122
|
-
key: PROMPT_KEYS.BASE_TEMPLATE,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
if (!response.result.success) {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
return response.result?.data?.exists === true;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Clear all seeded prompts
|
|
132
|
-
*/
|
|
133
|
-
async clearAll() {
|
|
134
|
-
await this.storage.use(this.storage.address, {
|
|
135
|
-
method: 'clear_prompt',
|
|
136
|
-
params: {
|
|
137
|
-
promptId: PROMPT_IDS.AGENT,
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { ToolResult } from '@olane/o-tool';
|
|
2
|
-
import { StorageProviderTool } from '@olane/o-storage';
|
|
3
|
-
import { oRequest } from '@olane/o-core';
|
|
4
|
-
import { GetDataResponse } from '@olane/o-storage';
|
|
5
|
-
import { PromptStorageConfig, PromptStats, ListPromptsResponse, PromptKeysResponse, ClearPromptResponse } from './interfaces/prompt-storage.interface.js';
|
|
6
|
-
import { oNodeAddress } from '@olane/o-node';
|
|
7
|
-
/**
|
|
8
|
-
* Prompt-specific storage provider that isolates data per prompt/conversation
|
|
9
|
-
* Extends StorageProviderTool to provide namespace isolation by promptId
|
|
10
|
-
*
|
|
11
|
-
* Features:
|
|
12
|
-
* - Isolated storage namespaces per promptId
|
|
13
|
-
* - Standard CRUD operations (put, get, delete, has)
|
|
14
|
-
* - Prompt management (list, clear, stats)
|
|
15
|
-
* - Optional TTL-based cleanup for inactive prompts
|
|
16
|
-
* - Memory-efficient nested Map structure
|
|
17
|
-
*/
|
|
18
|
-
export declare class PromptStorageProvider extends StorageProviderTool {
|
|
19
|
-
readonly config: PromptStorageConfig;
|
|
20
|
-
/**
|
|
21
|
-
* Node address (inherited from base class)
|
|
22
|
-
*/
|
|
23
|
-
readonly address: oNodeAddress;
|
|
24
|
-
/**
|
|
25
|
-
* Nested storage: Map<promptId, Map<key, value>>
|
|
26
|
-
* Provides O(1) access with automatic namespace isolation
|
|
27
|
-
*/
|
|
28
|
-
private storage;
|
|
29
|
-
/**
|
|
30
|
-
* Metadata tracking per prompt for stats and cleanup
|
|
31
|
-
*/
|
|
32
|
-
private metadata;
|
|
33
|
-
/**
|
|
34
|
-
* Cleanup interval timer
|
|
35
|
-
*/
|
|
36
|
-
private cleanupTimer?;
|
|
37
|
-
constructor(config: PromptStorageConfig);
|
|
38
|
-
/**
|
|
39
|
-
* Initialize background cleanup task if TTL is configured
|
|
40
|
-
*/
|
|
41
|
-
hookStartFinished(): Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Store data in a prompt-specific namespace
|
|
44
|
-
* ✅ Throws errors for validation failures
|
|
45
|
-
* ✅ Returns raw data (base class wraps it)
|
|
46
|
-
*/
|
|
47
|
-
_tool_put(request: oRequest): Promise<ToolResult>;
|
|
48
|
-
/**
|
|
49
|
-
* Retrieve data from a prompt-specific namespace
|
|
50
|
-
* ✅ Throws errors for validation failures
|
|
51
|
-
* ✅ Returns raw data with null for missing keys
|
|
52
|
-
*/
|
|
53
|
-
_tool_get(request: oRequest): Promise<GetDataResponse>;
|
|
54
|
-
/**
|
|
55
|
-
* Delete a specific key from a prompt namespace
|
|
56
|
-
* ✅ Throws errors for validation failures
|
|
57
|
-
* ✅ Returns raw data
|
|
58
|
-
*/
|
|
59
|
-
_tool_delete(request: oRequest): Promise<ToolResult>;
|
|
60
|
-
/**
|
|
61
|
-
* Check if a key exists in a prompt namespace
|
|
62
|
-
* ✅ Throws errors for validation failures
|
|
63
|
-
* ✅ Returns raw data
|
|
64
|
-
*/
|
|
65
|
-
_tool_has(request: oRequest): Promise<ToolResult>;
|
|
66
|
-
/**
|
|
67
|
-
* List all prompt IDs with active storage
|
|
68
|
-
*/
|
|
69
|
-
_tool_list_prompts(_request: oRequest): Promise<ListPromptsResponse>;
|
|
70
|
-
/**
|
|
71
|
-
* Clear all data for a specific prompt namespace
|
|
72
|
-
*/
|
|
73
|
-
_tool_clear_prompt(request: oRequest): Promise<ClearPromptResponse>;
|
|
74
|
-
/**
|
|
75
|
-
* Get all keys stored in a specific prompt namespace
|
|
76
|
-
*/
|
|
77
|
-
_tool_get_prompt_keys(request: oRequest): Promise<PromptKeysResponse>;
|
|
78
|
-
/**
|
|
79
|
-
* Get statistics for a specific prompt namespace
|
|
80
|
-
*/
|
|
81
|
-
_tool_get_prompt_stats(request: oRequest): Promise<PromptStats>;
|
|
82
|
-
/**
|
|
83
|
-
* Cleanup resources on stop
|
|
84
|
-
*/
|
|
85
|
-
stop(): Promise<void>;
|
|
86
|
-
/**
|
|
87
|
-
* Update last accessed timestamp for a prompt
|
|
88
|
-
*/
|
|
89
|
-
private updateLastAccessed;
|
|
90
|
-
/**
|
|
91
|
-
* Clean up prompts that haven't been accessed within TTL
|
|
92
|
-
*/
|
|
93
|
-
private cleanupExpiredPrompts;
|
|
94
|
-
/**
|
|
95
|
-
* Evict the oldest prompt when max limit is reached
|
|
96
|
-
*/
|
|
97
|
-
private evictOldestPrompt;
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=prompt-storage-provider.tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-storage-provider.tool.d.ts","sourceRoot":"","sources":["../../../src/storage/prompt-storage-provider.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,qBAAa,qBAAsB,SAAQ,mBAAmB;IAuBhD,QAAQ,CAAC,MAAM,EAAE,mBAAmB;IAtBhD;;OAEG;IACH,SAAgB,OAAO,EAAG,YAAY,CAAC;IAEvC;;;OAGG;IACH,OAAO,CAAC,OAAO,CAAmC;IAElD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAA8B;IAG9C;;OAEG;IACH,OAAO,CAAC,YAAY,CAAC,CAAiB;gBAEjB,MAAM,EAAE,mBAAmB;IAgBhD;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBxC;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAwCvD;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IA+B5D;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAoC1D;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAyBvD;;OAEG;IACG,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAS1E;;OAEG;IACG,kBAAkB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA4BzE;;OAEG;IACG,qBAAqB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAyB3E;;OAEG;IACG,sBAAsB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;IA+BrE;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAyB7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAqB1B"}
|