@executioncontrolprotocol/extension-memory 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** In-memory stub for @executioncontrolprotocol/memory. @category Extensions */
|
|
2
|
+
export declare const memoryExtension: import("@executioncontrolprotocol/core").ExtensionDefinition;
|
|
3
|
+
export declare function registerMemoryExtension(): Promise<void>;
|
|
4
|
+
export default memoryExtension;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,gFAAgF;AAChF,eAAO,MAAM,eAAe,8DAsClB,CAAA;AAIV,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC,CAI7D;AAED,eAAe,eAAe,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineExtension, capabilityFor, globalRegistry, hook, catalogExtension } from "@executioncontrolprotocol/core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const store = new Map();
|
|
4
|
+
/** In-memory stub for @executioncontrolprotocol/memory. @category Extensions */
|
|
5
|
+
export const memoryExtension = defineExtension("@executioncontrolprotocol", "memory")
|
|
6
|
+
.withConfig({
|
|
7
|
+
hydrateModels: z.boolean().default(true),
|
|
8
|
+
rememberOutputs: z.boolean().default(false),
|
|
9
|
+
collections: z.array(z.string()).default([]),
|
|
10
|
+
})
|
|
11
|
+
.withCapabilities([
|
|
12
|
+
capabilityFor("@executioncontrolprotocol/memory", "search")
|
|
13
|
+
.withInput(z.object({ query: z.string(), since: z.string().optional() }))
|
|
14
|
+
.withOutput(z.object({ results: z.array(z.unknown()) }))
|
|
15
|
+
.withHandler(async (input) => {
|
|
16
|
+
const q = input.query.toLowerCase();
|
|
17
|
+
const all = [...store.values()].flat();
|
|
18
|
+
return {
|
|
19
|
+
results: all.filter((r) => JSON.stringify(r).toLowerCase().includes(q)),
|
|
20
|
+
};
|
|
21
|
+
}),
|
|
22
|
+
capabilityFor("@executioncontrolprotocol/memory", "remember")
|
|
23
|
+
.withInput(z.object({ entry: z.unknown(), collection: z.string().optional() }))
|
|
24
|
+
.withOutput(z.object({ stored: z.boolean() }))
|
|
25
|
+
.withHandler(async (input) => {
|
|
26
|
+
const col = input.collection ?? "default";
|
|
27
|
+
const list = store.get(col) ?? [];
|
|
28
|
+
list.push(input.entry);
|
|
29
|
+
store.set(col, list);
|
|
30
|
+
return { stored: true };
|
|
31
|
+
}),
|
|
32
|
+
])
|
|
33
|
+
.withHooks([
|
|
34
|
+
hook("step:completed", async (ctx) => {
|
|
35
|
+
if (ctx.output === undefined || !ctx.step)
|
|
36
|
+
return;
|
|
37
|
+
const col = "step-outputs";
|
|
38
|
+
const list = store.get(col) ?? [];
|
|
39
|
+
list.push({ stepId: ctx.step.id, output: ctx.output });
|
|
40
|
+
store.set(col, list);
|
|
41
|
+
}),
|
|
42
|
+
hook("run:finally", async () => undefined),
|
|
43
|
+
])
|
|
44
|
+
.build();
|
|
45
|
+
catalogExtension(memoryExtension);
|
|
46
|
+
export async function registerMemoryExtension() {
|
|
47
|
+
if (!globalRegistry.getExtension("@executioncontrolprotocol/memory")) {
|
|
48
|
+
await globalRegistry.registerExtension(memoryExtension);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export default memoryExtension;
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,gBAAg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,IAAI,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS,CAAC;CAC3C,CAAC;KACD,KAAK,EAAE,CAAA;AAEV,gBAAgB,CAAC,eAAe,CAAC,CAAA;AAEjC,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,kCAAkC,CAAC,EAAE,CAAC;QACrE,MAAM,cAAc,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAA;IACzD,CAAC;AACH,CAAC;AAED,eAAe,eAAe,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@executioncontrolprotocol/extension-memory",
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "In-memory collections extension for ECP",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -b"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@executioncontrolprotocol/core": "^0.10.0",
|
|
24
|
+
"@executioncontrolprotocol/types": "^0.10.0",
|
|
25
|
+
"zod": "^3.24.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@executioncontrolprotocol/core": "0.10.0",
|
|
29
|
+
"@executioncontrolprotocol/types": "0.10.0",
|
|
30
|
+
"typescript": "^5.7.0",
|
|
31
|
+
"zod": "^3.24.0"
|
|
32
|
+
}
|
|
33
|
+
}
|