@cogitator-ai/core 0.19.3 → 0.19.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogitator-ai/core",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.4",
|
|
4
4
|
"description": "Core runtime for Cogitator AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"nanoid": "^5.0.4",
|
|
20
20
|
"openai": "^6.22.0",
|
|
21
21
|
"zod": "^4.3.6",
|
|
22
|
-
"@cogitator-ai/memory": "0.6.
|
|
23
|
-
"@cogitator-ai/models": "17.1.
|
|
24
|
-
"@cogitator-ai/types": "0.22.
|
|
22
|
+
"@cogitator-ai/memory": "0.6.22",
|
|
23
|
+
"@cogitator-ai/models": "17.1.9",
|
|
24
|
+
"@cogitator-ai/types": "0.22.3"
|
|
25
25
|
},
|
|
26
26
|
"optionalDependencies": {
|
|
27
27
|
"pg": "^8.18.0"
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"@types/node": "^25.0.10",
|
|
32
32
|
"@types/pg": "^8.10.9",
|
|
33
33
|
"typescript": "^5.3.0",
|
|
34
|
-
"vitest": "^4.0.18"
|
|
34
|
+
"vitest": "^4.0.18",
|
|
35
|
+
"@cogitator-ai/sandbox": "0.2.29"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
38
|
"@aws-sdk/client-bedrock-runtime": "^3.0.0",
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
"langfuse": "^3.0.0",
|
|
40
41
|
"nodemailer": "^6.0.0",
|
|
41
42
|
"pg": "^8.0.0",
|
|
42
|
-
"@cogitator-ai/sandbox": "0.2.
|
|
43
|
+
"@cogitator-ai/sandbox": "0.2.29"
|
|
43
44
|
},
|
|
44
45
|
"peerDependenciesMeta": {
|
|
45
46
|
"@aws-sdk/client-bedrock-runtime": {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Tool } from '@cogitator-ai/types';
|
|
2
|
-
export declare function createSelfConfigTools(opts: {
|
|
3
|
-
configPath: string;
|
|
4
|
-
parseYaml: (s: string) => unknown;
|
|
5
|
-
stringifyYaml: (o: unknown) => string;
|
|
6
|
-
validateConfig: (o: unknown) => unknown;
|
|
7
|
-
onConfigUpdated?: () => void;
|
|
8
|
-
}): Tool[];
|
|
9
|
-
//# sourceMappingURL=self-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"self-config.d.ts","sourceRoot":"","sources":["../../src/tools/self-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AA0BhD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;IACtC,cAAc,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B,GAAG,IAAI,EAAE,CA2CT"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { tool } from '../tool.js';
|
|
4
|
-
function deepMerge(target, source) {
|
|
5
|
-
const result = { ...target };
|
|
6
|
-
for (const key of Object.keys(source)) {
|
|
7
|
-
const srcVal = source[key];
|
|
8
|
-
const tgtVal = target[key];
|
|
9
|
-
if (srcVal !== null &&
|
|
10
|
-
typeof srcVal === 'object' &&
|
|
11
|
-
!Array.isArray(srcVal) &&
|
|
12
|
-
tgtVal !== null &&
|
|
13
|
-
typeof tgtVal === 'object' &&
|
|
14
|
-
!Array.isArray(tgtVal)) {
|
|
15
|
-
result[key] = deepMerge(tgtVal, srcVal);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
result[key] = srcVal;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
export function createSelfConfigTools(opts) {
|
|
24
|
-
const { configPath, parseYaml, stringifyYaml, validateConfig, onConfigUpdated } = opts;
|
|
25
|
-
const configRead = tool({
|
|
26
|
-
name: 'config_read',
|
|
27
|
-
description: 'Read the current assistant configuration (cogitator.yml)',
|
|
28
|
-
parameters: z.object({}),
|
|
29
|
-
execute: async () => {
|
|
30
|
-
const raw = readFileSync(configPath, 'utf-8');
|
|
31
|
-
return { config: parseYaml(raw) };
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
const configUpdate = tool({
|
|
35
|
-
name: 'config_update',
|
|
36
|
-
description: 'Update assistant configuration. Provide a partial config object that will be deep-merged with the current config. Changes are validated before saving. The assistant will restart automatically after a successful update.',
|
|
37
|
-
parameters: z.object({
|
|
38
|
-
updates: z
|
|
39
|
-
.record(z.string(), z.unknown())
|
|
40
|
-
.describe('Partial config to deep-merge with current config'),
|
|
41
|
-
}),
|
|
42
|
-
execute: async ({ updates }) => {
|
|
43
|
-
const raw = readFileSync(configPath, 'utf-8');
|
|
44
|
-
const current = parseYaml(raw);
|
|
45
|
-
const merged = deepMerge(current, updates);
|
|
46
|
-
try {
|
|
47
|
-
validateConfig(merged);
|
|
48
|
-
}
|
|
49
|
-
catch (err) {
|
|
50
|
-
return {
|
|
51
|
-
success: false,
|
|
52
|
-
error: `Validation failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
writeFileSync(configPath, stringifyYaml(merged));
|
|
56
|
-
onConfigUpdated?.();
|
|
57
|
-
return { success: true, message: 'Config updated. Restarting...' };
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
return [configRead, configUpdate];
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=self-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"self-config.js","sourceRoot":"","sources":["../../src/tools/self-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,SAAS,SAAS,CAChB,MAA+B,EAC/B,MAA+B;IAE/B,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3B,IACE,MAAM,KAAK,IAAI;YACf,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YACtB,MAAM,KAAK,IAAI;YACf,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EACtB,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAiC,EAAE,MAAiC,CAAC,CAAC;QAChG,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAMrC;IACC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;IAEvF,MAAM,U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