hoomanjs 1.9.0 → 1.11.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/README.md +38 -37
- package/package.json +1 -1
- package/src/acp/acp-agent.ts +3 -10
- package/src/acp/sessions/config-options.ts +44 -7
- package/src/acp/utils/tool-kind.ts +6 -0
- package/src/acp/utils/tool-locations.ts +2 -0
- package/src/cli.ts +7 -33
- package/src/configure/app.tsx +244 -55
- package/src/configure/types.ts +2 -0
- package/src/configure/utils.ts +21 -0
- package/src/core/agent/index.ts +10 -17
- package/src/core/config.ts +140 -27
- package/src/core/index.ts +1 -9
- package/src/core/prompts/index.ts +2 -7
- package/src/core/prompts/static/ltm.md +39 -28
- package/src/core/prompts/static/wiki.md +81 -0
- package/src/core/prompts/system.ts +12 -11
- package/src/core/tools/index.ts +1 -0
- package/src/core/tools/wiki.ts +703 -0
- package/src/core/prompts/static/memory.md +0 -39
- package/src/core/toolkit.ts +0 -13
package/src/configure/app.tsx
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
noticeColor,
|
|
40
40
|
parseNumber,
|
|
41
41
|
parseObjectRecord,
|
|
42
|
+
maskSensitiveParamsForDisplay,
|
|
42
43
|
parseStringArray,
|
|
43
44
|
parseStringRecord,
|
|
44
45
|
transportSummary,
|
|
@@ -131,7 +132,7 @@ export function ConfigureApp({
|
|
|
131
132
|
name: config.name,
|
|
132
133
|
llm: config.llm,
|
|
133
134
|
tools: config.tools,
|
|
134
|
-
|
|
135
|
+
features: config.features,
|
|
135
136
|
compaction: config.compaction,
|
|
136
137
|
}) satisfies ConfigData,
|
|
137
138
|
[config, revision],
|
|
@@ -412,7 +413,9 @@ export function ConfigureApp({
|
|
|
412
413
|
}),
|
|
413
414
|
},
|
|
414
415
|
{
|
|
415
|
-
label: `LLM params • ${truncate(
|
|
416
|
+
label: `LLM params • ${truncate(
|
|
417
|
+
compactJson(maskSensitiveParamsForDisplay(configData.llm.params)),
|
|
418
|
+
)}`,
|
|
416
419
|
value: () =>
|
|
417
420
|
promptValue({
|
|
418
421
|
title: "Update LLM params",
|
|
@@ -445,75 +448,63 @@ export function ConfigureApp({
|
|
|
445
448
|
}),
|
|
446
449
|
},
|
|
447
450
|
{
|
|
448
|
-
label: `
|
|
451
|
+
label: `Fetch feature • ${configData.features.fetch.enabled ? "Enabled" : "Disabled"}`,
|
|
449
452
|
value: () => {
|
|
450
453
|
updateConfig(
|
|
451
454
|
{
|
|
452
|
-
|
|
453
|
-
...config.
|
|
454
|
-
|
|
455
|
+
features: {
|
|
456
|
+
...config.features,
|
|
457
|
+
fetch: {
|
|
458
|
+
enabled: !configData.features.fetch.enabled,
|
|
459
|
+
},
|
|
455
460
|
},
|
|
456
461
|
},
|
|
457
|
-
`
|
|
462
|
+
`Fetch feature ${configData.features.fetch.enabled ? "disabled" : "enabled"}.`,
|
|
458
463
|
);
|
|
459
464
|
setScreen({ kind: "config" });
|
|
460
465
|
},
|
|
461
466
|
},
|
|
462
467
|
{
|
|
463
|
-
label: `
|
|
464
|
-
value: () =>
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
if (!url) {
|
|
472
|
-
throw new Error("URL is required.");
|
|
473
|
-
}
|
|
474
|
-
updateConfig(
|
|
475
|
-
{
|
|
476
|
-
ltm: {
|
|
477
|
-
...config.ltm,
|
|
478
|
-
chroma: {
|
|
479
|
-
...config.ltm.chroma,
|
|
480
|
-
url,
|
|
481
|
-
},
|
|
482
|
-
},
|
|
468
|
+
label: `Filesystem feature • ${configData.features.filesystem.enabled ? "Enabled" : "Disabled"}`,
|
|
469
|
+
value: () => {
|
|
470
|
+
updateConfig(
|
|
471
|
+
{
|
|
472
|
+
features: {
|
|
473
|
+
...config.features,
|
|
474
|
+
filesystem: {
|
|
475
|
+
enabled: !configData.features.filesystem.enabled,
|
|
483
476
|
},
|
|
484
|
-
|
|
485
|
-
);
|
|
486
|
-
setPrompt(null);
|
|
477
|
+
},
|
|
487
478
|
},
|
|
488
|
-
|
|
479
|
+
`Filesystem feature ${configData.features.filesystem.enabled ? "disabled" : "enabled"}.`,
|
|
480
|
+
);
|
|
481
|
+
setScreen({ kind: "config" });
|
|
482
|
+
},
|
|
489
483
|
},
|
|
490
484
|
{
|
|
491
|
-
label: `
|
|
492
|
-
value: () =>
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (!memory) {
|
|
500
|
-
throw new Error("Collection name is required.");
|
|
501
|
-
}
|
|
502
|
-
updateConfig(
|
|
503
|
-
{
|
|
504
|
-
ltm: {
|
|
505
|
-
...config.ltm,
|
|
506
|
-
chroma: {
|
|
507
|
-
...config.ltm.chroma,
|
|
508
|
-
collection: { memory },
|
|
509
|
-
},
|
|
510
|
-
},
|
|
485
|
+
label: `Shell feature • ${configData.features.shell.enabled ? "Enabled" : "Disabled"}`,
|
|
486
|
+
value: () => {
|
|
487
|
+
updateConfig(
|
|
488
|
+
{
|
|
489
|
+
features: {
|
|
490
|
+
...config.features,
|
|
491
|
+
shell: {
|
|
492
|
+
enabled: !configData.features.shell.enabled,
|
|
511
493
|
},
|
|
512
|
-
|
|
513
|
-
);
|
|
514
|
-
setPrompt(null);
|
|
494
|
+
},
|
|
515
495
|
},
|
|
516
|
-
|
|
496
|
+
`Shell feature ${configData.features.shell.enabled ? "disabled" : "enabled"}.`,
|
|
497
|
+
);
|
|
498
|
+
setScreen({ kind: "config" });
|
|
499
|
+
},
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
label: `Long-term memory • ${configData.features.ltm.enabled ? "Enabled" : "Disabled"} • ${configData.features.ltm.chroma.collection.memory}`,
|
|
503
|
+
value: () => setScreen({ kind: "config-ltm" }),
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
label: `Wiki feature • ${configData.features.wiki.enabled ? "Enabled" : "Disabled"} • ${configData.features.wiki.chroma.collection.wiki}`,
|
|
507
|
+
value: () => setScreen({ kind: "config-wiki" }),
|
|
517
508
|
},
|
|
518
509
|
{
|
|
519
510
|
label: `Compaction ratio • ${configData.compaction.ratio}`,
|
|
@@ -610,6 +601,200 @@ export function ConfigureApp({
|
|
|
610
601
|
);
|
|
611
602
|
};
|
|
612
603
|
|
|
604
|
+
const renderLtmConfigMenu = () => {
|
|
605
|
+
const items: MenuItem[] = [
|
|
606
|
+
{
|
|
607
|
+
label: `Enabled • ${configData.features.ltm.enabled ? "On" : "Off"}`,
|
|
608
|
+
value: () => {
|
|
609
|
+
updateConfig(
|
|
610
|
+
{
|
|
611
|
+
features: {
|
|
612
|
+
...config.features,
|
|
613
|
+
ltm: {
|
|
614
|
+
...config.features.ltm,
|
|
615
|
+
enabled: !configData.features.ltm.enabled,
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
`Long-term memory ${configData.features.ltm.enabled ? "disabled" : "enabled"}.`,
|
|
620
|
+
);
|
|
621
|
+
setScreen({ kind: "config-ltm" });
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
label: `Chroma URL • ${configData.features.ltm.chroma.url}`,
|
|
626
|
+
value: () =>
|
|
627
|
+
promptValue({
|
|
628
|
+
title: "Update LTM Chroma URL",
|
|
629
|
+
label: "URL",
|
|
630
|
+
initialValue: configData.features.ltm.chroma.url,
|
|
631
|
+
onSubmit: async (value) => {
|
|
632
|
+
const url = value.trim();
|
|
633
|
+
if (!url) {
|
|
634
|
+
throw new Error("URL is required.");
|
|
635
|
+
}
|
|
636
|
+
updateConfig(
|
|
637
|
+
{
|
|
638
|
+
features: {
|
|
639
|
+
...config.features,
|
|
640
|
+
ltm: {
|
|
641
|
+
...config.features.ltm,
|
|
642
|
+
chroma: {
|
|
643
|
+
...config.features.ltm.chroma,
|
|
644
|
+
url,
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
},
|
|
648
|
+
},
|
|
649
|
+
"Updated LTM Chroma URL.",
|
|
650
|
+
);
|
|
651
|
+
setPrompt(null);
|
|
652
|
+
},
|
|
653
|
+
}),
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
label: `Chroma collection • ${configData.features.ltm.chroma.collection.memory}`,
|
|
657
|
+
value: () =>
|
|
658
|
+
promptValue({
|
|
659
|
+
title: "Update LTM Chroma collection",
|
|
660
|
+
label: "Collection name",
|
|
661
|
+
initialValue: configData.features.ltm.chroma.collection.memory,
|
|
662
|
+
onSubmit: async (value) => {
|
|
663
|
+
const memory = value.trim();
|
|
664
|
+
if (!memory) {
|
|
665
|
+
throw new Error("Collection name is required.");
|
|
666
|
+
}
|
|
667
|
+
updateConfig(
|
|
668
|
+
{
|
|
669
|
+
features: {
|
|
670
|
+
...config.features,
|
|
671
|
+
ltm: {
|
|
672
|
+
...config.features.ltm,
|
|
673
|
+
chroma: {
|
|
674
|
+
...config.features.ltm.chroma,
|
|
675
|
+
collection: { memory },
|
|
676
|
+
},
|
|
677
|
+
},
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
"Updated LTM Chroma collection.",
|
|
681
|
+
);
|
|
682
|
+
setPrompt(null);
|
|
683
|
+
},
|
|
684
|
+
}),
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
label: "Back",
|
|
688
|
+
value: () => setScreen({ kind: "config" }),
|
|
689
|
+
},
|
|
690
|
+
];
|
|
691
|
+
|
|
692
|
+
return (
|
|
693
|
+
<MenuScreen
|
|
694
|
+
title="Long-term Memory"
|
|
695
|
+
description="Configure LTM memory storage and Chroma settings."
|
|
696
|
+
items={items}
|
|
697
|
+
/>
|
|
698
|
+
);
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
const renderWikiConfigMenu = () => {
|
|
702
|
+
const items: MenuItem[] = [
|
|
703
|
+
{
|
|
704
|
+
label: `Enabled • ${configData.features.wiki.enabled ? "On" : "Off"}`,
|
|
705
|
+
value: () => {
|
|
706
|
+
updateConfig(
|
|
707
|
+
{
|
|
708
|
+
features: {
|
|
709
|
+
...config.features,
|
|
710
|
+
wiki: {
|
|
711
|
+
...config.features.wiki,
|
|
712
|
+
enabled: !configData.features.wiki.enabled,
|
|
713
|
+
},
|
|
714
|
+
},
|
|
715
|
+
},
|
|
716
|
+
`Wiki feature ${configData.features.wiki.enabled ? "disabled" : "enabled"}.`,
|
|
717
|
+
);
|
|
718
|
+
setScreen({ kind: "config-wiki" });
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
label: `Chroma URL • ${configData.features.wiki.chroma.url}`,
|
|
723
|
+
value: () =>
|
|
724
|
+
promptValue({
|
|
725
|
+
title: "Update Wiki Chroma URL",
|
|
726
|
+
label: "URL",
|
|
727
|
+
initialValue: configData.features.wiki.chroma.url,
|
|
728
|
+
onSubmit: async (value) => {
|
|
729
|
+
const url = value.trim();
|
|
730
|
+
if (!url) {
|
|
731
|
+
throw new Error("URL is required.");
|
|
732
|
+
}
|
|
733
|
+
updateConfig(
|
|
734
|
+
{
|
|
735
|
+
features: {
|
|
736
|
+
...config.features,
|
|
737
|
+
wiki: {
|
|
738
|
+
...config.features.wiki,
|
|
739
|
+
chroma: {
|
|
740
|
+
...config.features.wiki.chroma,
|
|
741
|
+
url,
|
|
742
|
+
},
|
|
743
|
+
},
|
|
744
|
+
},
|
|
745
|
+
},
|
|
746
|
+
"Updated Wiki Chroma URL.",
|
|
747
|
+
);
|
|
748
|
+
setPrompt(null);
|
|
749
|
+
},
|
|
750
|
+
}),
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
label: `Chroma collection • ${configData.features.wiki.chroma.collection.wiki}`,
|
|
754
|
+
value: () =>
|
|
755
|
+
promptValue({
|
|
756
|
+
title: "Update Wiki Chroma collection",
|
|
757
|
+
label: "Collection name",
|
|
758
|
+
initialValue: configData.features.wiki.chroma.collection.wiki,
|
|
759
|
+
onSubmit: async (value) => {
|
|
760
|
+
const wiki = value.trim();
|
|
761
|
+
if (!wiki) {
|
|
762
|
+
throw new Error("Collection name is required.");
|
|
763
|
+
}
|
|
764
|
+
updateConfig(
|
|
765
|
+
{
|
|
766
|
+
features: {
|
|
767
|
+
...config.features,
|
|
768
|
+
wiki: {
|
|
769
|
+
...config.features.wiki,
|
|
770
|
+
chroma: {
|
|
771
|
+
...config.features.wiki.chroma,
|
|
772
|
+
collection: { wiki },
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
"Updated Wiki Chroma collection.",
|
|
778
|
+
);
|
|
779
|
+
setPrompt(null);
|
|
780
|
+
},
|
|
781
|
+
}),
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
label: "Back",
|
|
785
|
+
value: () => setScreen({ kind: "config" }),
|
|
786
|
+
},
|
|
787
|
+
];
|
|
788
|
+
|
|
789
|
+
return (
|
|
790
|
+
<MenuScreen
|
|
791
|
+
title="Wiki"
|
|
792
|
+
description="Configure wiki features and Chroma-backed wiki search."
|
|
793
|
+
items={items}
|
|
794
|
+
/>
|
|
795
|
+
);
|
|
796
|
+
};
|
|
797
|
+
|
|
613
798
|
const renderMcpMenu = () => {
|
|
614
799
|
const serverItems: MenuItem[] = mcpServers.flatMap((server) => [
|
|
615
800
|
{
|
|
@@ -876,6 +1061,10 @@ export function ConfigureApp({
|
|
|
876
1061
|
return renderConfigMenu();
|
|
877
1062
|
case "config-provider":
|
|
878
1063
|
return renderProviderMenu();
|
|
1064
|
+
case "config-ltm":
|
|
1065
|
+
return renderLtmConfigMenu();
|
|
1066
|
+
case "config-wiki":
|
|
1067
|
+
return renderWikiConfigMenu();
|
|
879
1068
|
case "mcp":
|
|
880
1069
|
return renderMcpMenu();
|
|
881
1070
|
case "mcp-delete-confirm":
|
package/src/configure/types.ts
CHANGED
package/src/configure/utils.ts
CHANGED
|
@@ -16,6 +16,27 @@ export function compactJson(value: unknown): string {
|
|
|
16
16
|
return JSON.stringify(value);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
const MASKED_PARAM_KEYS = new Set(["apikey", "clientconfig"]);
|
|
20
|
+
|
|
21
|
+
export function maskSensitiveParamsForDisplay(value: unknown): unknown {
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
return value.map((item) => maskSensitiveParamsForDisplay(item));
|
|
24
|
+
}
|
|
25
|
+
if (!value || typeof value !== "object") {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
const input = value as Record<string, unknown>;
|
|
29
|
+
const output: Record<string, unknown> = {};
|
|
30
|
+
for (const [key, itemValue] of Object.entries(input)) {
|
|
31
|
+
if (MASKED_PARAM_KEYS.has(key.toLowerCase())) {
|
|
32
|
+
output[key] = "[REDACTED]";
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
output[key] = maskSensitiveParamsForDisplay(itemValue);
|
|
36
|
+
}
|
|
37
|
+
return output;
|
|
38
|
+
}
|
|
39
|
+
|
|
19
40
|
export function truncate(text: string, max: number = 88): string {
|
|
20
41
|
return text.length > max ? `${text.slice(0, max - 1)}…` : text;
|
|
21
42
|
}
|
package/src/core/agent/index.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { Agent } from "@strands-agents/sdk";
|
|
2
2
|
import type { Config } from "../config.ts";
|
|
3
3
|
import { modelProviders } from "../models";
|
|
4
|
-
import {
|
|
5
|
-
type Config as McpConfig,
|
|
6
|
-
type Manager as McpManager,
|
|
7
|
-
createMcpTools,
|
|
8
|
-
} from "../mcp";
|
|
4
|
+
import { type Config as McpConfig, type Manager as McpManager } from "../mcp";
|
|
9
5
|
import type { System as SystemPrompt } from "../prompts";
|
|
10
6
|
import { skills as createSkillsPrompt } from "../prompts";
|
|
11
7
|
import {
|
|
@@ -14,16 +10,14 @@ import {
|
|
|
14
10
|
createLongTermMemoryTools,
|
|
15
11
|
} from "../memory";
|
|
16
12
|
import type { Registry } from "../skills";
|
|
17
|
-
import { createSkillsTools } from "../skills";
|
|
18
13
|
import {
|
|
19
14
|
createFetchTools,
|
|
20
15
|
createFilesystemTools,
|
|
21
16
|
createShellTools,
|
|
22
17
|
createThinkingTools,
|
|
23
18
|
createTimeTools,
|
|
19
|
+
createWikiTools,
|
|
24
20
|
} from "../tools";
|
|
25
|
-
import { toolkitAtLeast } from "../toolkit.ts";
|
|
26
|
-
import type { Toolkit } from "../toolkit.ts";
|
|
27
21
|
|
|
28
22
|
const SECTION_BREAK = "\n\n---\n\n";
|
|
29
23
|
|
|
@@ -37,15 +31,15 @@ export async function create(
|
|
|
37
31
|
userId?: string;
|
|
38
32
|
sessionId?: string;
|
|
39
33
|
systemPrompt?: string;
|
|
40
|
-
toolkit?: Toolkit;
|
|
41
34
|
},
|
|
42
35
|
): Promise<Agent> {
|
|
43
36
|
const sessionId = meta.sessionId;
|
|
44
37
|
const userId = meta.userId ?? sessionId;
|
|
45
|
-
const toolkit = meta.toolkit ?? "full";
|
|
46
38
|
const llm = await modelProviders[config.llm.provider]!();
|
|
47
39
|
const stm = createShortTermMemory(sessionId);
|
|
48
|
-
const ltm = config.ltm.enabled
|
|
40
|
+
const ltm = config.features.ltm.enabled
|
|
41
|
+
? createLongTermMemoryStore(config)
|
|
42
|
+
: null;
|
|
49
43
|
const skills = await createSkillsPrompt(registry);
|
|
50
44
|
const tools = await mcp.manager.listPrefixedTools();
|
|
51
45
|
const append = await mcp.manager.listServerInstructions();
|
|
@@ -62,13 +56,12 @@ export async function create(
|
|
|
62
56
|
},
|
|
63
57
|
tools: [
|
|
64
58
|
...createTimeTools(),
|
|
65
|
-
...createFetchTools(),
|
|
59
|
+
...(config.features.fetch.enabled ? createFetchTools() : []),
|
|
66
60
|
...(ltm ? createLongTermMemoryTools(ltm) : []),
|
|
67
|
-
...(
|
|
68
|
-
...(
|
|
69
|
-
...(
|
|
70
|
-
...(
|
|
71
|
-
...(toolkit === "max" ? createMcpTools(mcp.config) : []),
|
|
61
|
+
...(config.features.filesystem.enabled ? createFilesystemTools() : []),
|
|
62
|
+
...(config.features.shell.enabled ? createShellTools() : []),
|
|
63
|
+
...(config.features.wiki.enabled ? createWikiTools(config) : []),
|
|
64
|
+
...createThinkingTools(),
|
|
72
65
|
...tools,
|
|
73
66
|
],
|
|
74
67
|
printer: print,
|
package/src/core/config.ts
CHANGED
|
@@ -34,7 +34,12 @@ const DEFAULT_CHROMA = {
|
|
|
34
34
|
collection: { memory: "memory" },
|
|
35
35
|
} as const;
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const DEFAULT_WIKI_CHROMA = {
|
|
38
|
+
url: "http://127.0.0.1:8000",
|
|
39
|
+
collection: { wiki: "wiki" },
|
|
40
|
+
} as const;
|
|
41
|
+
|
|
42
|
+
const LtmChromaPartialSchema = z.object({
|
|
38
43
|
url: z.string().min(1).optional(),
|
|
39
44
|
collection: z
|
|
40
45
|
.object({
|
|
@@ -45,38 +50,101 @@ const ChromaPartialSchema = z.object({
|
|
|
45
50
|
|
|
46
51
|
const LtmPartialSchema = z.object({
|
|
47
52
|
enabled: z.boolean().optional(),
|
|
48
|
-
chroma:
|
|
53
|
+
chroma: LtmChromaPartialSchema.optional(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const WikiChromaPartialSchema = z.object({
|
|
57
|
+
url: z.string().min(1).optional(),
|
|
58
|
+
collection: z
|
|
59
|
+
.object({
|
|
60
|
+
wiki: z.string().min(1).optional(),
|
|
61
|
+
})
|
|
62
|
+
.optional(),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const WikiPartialSchema = z.object({
|
|
66
|
+
enabled: z.boolean().optional(),
|
|
67
|
+
chroma: WikiChromaPartialSchema.optional(),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const FeatureTogglePartialSchema = z.object({
|
|
71
|
+
enabled: z.boolean().optional(),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const FeaturesPartialSchema = z.object({
|
|
75
|
+
fetch: FeatureTogglePartialSchema.optional(),
|
|
76
|
+
filesystem: FeatureTogglePartialSchema.optional(),
|
|
77
|
+
shell: FeatureTogglePartialSchema.optional(),
|
|
78
|
+
ltm: LtmPartialSchema.optional(),
|
|
79
|
+
wiki: WikiPartialSchema.optional(),
|
|
49
80
|
});
|
|
50
81
|
|
|
51
82
|
const ToolsPartialSchema = z.object({
|
|
52
83
|
allowed: z.array(z.string().min(1)).default([]),
|
|
53
84
|
});
|
|
54
85
|
|
|
55
|
-
const ConfigSchema = z
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
const ConfigSchema = z
|
|
87
|
+
.object({
|
|
88
|
+
name: z.string().min(1),
|
|
89
|
+
llm: LlmSchema,
|
|
90
|
+
tools: ToolsPartialSchema.default({ allowed: [] }),
|
|
91
|
+
features: FeaturesPartialSchema.nullish(),
|
|
92
|
+
compaction: CompactionPartialSchema.nullish().transform((c) => ({
|
|
93
|
+
ratio: c?.ratio ?? DEFAULT_COMPACTION.ratio,
|
|
94
|
+
keep: c?.keep ?? DEFAULT_COMPACTION.keep,
|
|
95
|
+
})),
|
|
96
|
+
})
|
|
97
|
+
.transform((input) => {
|
|
98
|
+
const ltm = input.features?.ltm;
|
|
99
|
+
const wiki = input.features?.wiki;
|
|
100
|
+
return {
|
|
101
|
+
name: input.name,
|
|
102
|
+
llm: input.llm,
|
|
103
|
+
tools: input.tools,
|
|
104
|
+
features: {
|
|
105
|
+
fetch: {
|
|
106
|
+
enabled: input.features?.fetch?.enabled ?? true,
|
|
107
|
+
},
|
|
108
|
+
filesystem: {
|
|
109
|
+
enabled: input.features?.filesystem?.enabled ?? true,
|
|
110
|
+
},
|
|
111
|
+
shell: {
|
|
112
|
+
enabled: input.features?.shell?.enabled ?? true,
|
|
113
|
+
},
|
|
114
|
+
ltm: {
|
|
115
|
+
enabled: ltm?.enabled ?? false,
|
|
116
|
+
chroma: {
|
|
117
|
+
url: ltm?.chroma?.url ?? DEFAULT_CHROMA.url,
|
|
118
|
+
collection: {
|
|
119
|
+
memory:
|
|
120
|
+
ltm?.chroma?.collection?.memory ??
|
|
121
|
+
DEFAULT_CHROMA.collection.memory,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
wiki: {
|
|
126
|
+
enabled: wiki?.enabled ?? false,
|
|
127
|
+
chroma: {
|
|
128
|
+
url: wiki?.chroma?.url ?? DEFAULT_WIKI_CHROMA.url,
|
|
129
|
+
collection: {
|
|
130
|
+
wiki:
|
|
131
|
+
wiki?.chroma?.collection?.wiki ??
|
|
132
|
+
DEFAULT_WIKI_CHROMA.collection.wiki,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
66
136
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
ratio: c?.ratio ?? DEFAULT_COMPACTION.ratio,
|
|
71
|
-
keep: c?.keep ?? DEFAULT_COMPACTION.keep,
|
|
72
|
-
})),
|
|
73
|
-
});
|
|
137
|
+
compaction: input.compaction,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
74
140
|
|
|
75
141
|
export type ConfigData = z.infer<typeof ConfigSchema>;
|
|
76
142
|
export type LlmConfig = z.infer<typeof LlmSchema>;
|
|
77
143
|
export type CompactionConfig = ConfigData["compaction"];
|
|
78
|
-
export type LtmConfig = ConfigData["ltm"];
|
|
144
|
+
export type LtmConfig = ConfigData["features"]["ltm"];
|
|
145
|
+
export type WikiConfig = ConfigData["features"]["wiki"];
|
|
79
146
|
export type ToolsConfig = ConfigData["tools"];
|
|
147
|
+
export type FeaturesConfig = ConfigData["features"];
|
|
80
148
|
|
|
81
149
|
const defaultConfigData = (): ConfigData => ({
|
|
82
150
|
name: "Hooman",
|
|
@@ -88,11 +156,29 @@ const defaultConfigData = (): ConfigData => ({
|
|
|
88
156
|
tools: {
|
|
89
157
|
allowed: [],
|
|
90
158
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
159
|
+
features: {
|
|
160
|
+
fetch: {
|
|
161
|
+
enabled: true,
|
|
162
|
+
},
|
|
163
|
+
filesystem: {
|
|
164
|
+
enabled: true,
|
|
165
|
+
},
|
|
166
|
+
shell: {
|
|
167
|
+
enabled: true,
|
|
168
|
+
},
|
|
169
|
+
ltm: {
|
|
170
|
+
enabled: false,
|
|
171
|
+
chroma: {
|
|
172
|
+
url: "http://127.0.0.1:8000",
|
|
173
|
+
collection: { memory: "memory" },
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
wiki: {
|
|
177
|
+
enabled: false,
|
|
178
|
+
chroma: {
|
|
179
|
+
url: "http://127.0.0.1:8000",
|
|
180
|
+
collection: { wiki: "wiki" },
|
|
181
|
+
},
|
|
96
182
|
},
|
|
97
183
|
},
|
|
98
184
|
compaction: {
|
|
@@ -129,8 +215,35 @@ export class Config {
|
|
|
129
215
|
return this.data.compaction;
|
|
130
216
|
}
|
|
131
217
|
|
|
218
|
+
get features(): FeaturesConfig {
|
|
219
|
+
return {
|
|
220
|
+
...this.data.features,
|
|
221
|
+
fetch: { ...this.data.features.fetch },
|
|
222
|
+
filesystem: { ...this.data.features.filesystem },
|
|
223
|
+
shell: { ...this.data.features.shell },
|
|
224
|
+
ltm: {
|
|
225
|
+
...this.data.features.ltm,
|
|
226
|
+
chroma: {
|
|
227
|
+
...this.data.features.ltm.chroma,
|
|
228
|
+
collection: { ...this.data.features.ltm.chroma.collection },
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
wiki: {
|
|
232
|
+
...this.data.features.wiki,
|
|
233
|
+
chroma: {
|
|
234
|
+
...this.data.features.wiki.chroma,
|
|
235
|
+
collection: { ...this.data.features.wiki.chroma.collection },
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
132
241
|
get ltm(): LtmConfig {
|
|
133
|
-
return this.
|
|
242
|
+
return this.features.ltm;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
get wiki(): WikiConfig {
|
|
246
|
+
return this.features.wiki;
|
|
134
247
|
}
|
|
135
248
|
|
|
136
249
|
private readJson(): unknown {
|