ei-tui 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/LICENSE +21 -0
- package/README.md +170 -0
- package/package.json +63 -0
- package/src/README.md +96 -0
- package/src/cli/README.md +47 -0
- package/src/cli/commands/facts.ts +25 -0
- package/src/cli/commands/people.ts +25 -0
- package/src/cli/commands/quotes.ts +19 -0
- package/src/cli/commands/topics.ts +25 -0
- package/src/cli/commands/traits.ts +25 -0
- package/src/cli/retrieval.ts +269 -0
- package/src/cli.ts +176 -0
- package/src/core/AGENTS.md +104 -0
- package/src/core/embedding-service.ts +241 -0
- package/src/core/handlers/index.ts +1057 -0
- package/src/core/index.ts +4 -0
- package/src/core/llm-client.ts +265 -0
- package/src/core/model-context-windows.ts +49 -0
- package/src/core/orchestrators/ceremony.ts +500 -0
- package/src/core/orchestrators/extraction-chunker.ts +138 -0
- package/src/core/orchestrators/human-extraction.ts +457 -0
- package/src/core/orchestrators/index.ts +28 -0
- package/src/core/orchestrators/persona-generation.ts +76 -0
- package/src/core/orchestrators/persona-topics.ts +117 -0
- package/src/core/personas/index.ts +5 -0
- package/src/core/personas/opencode-agent.ts +81 -0
- package/src/core/processor.ts +1413 -0
- package/src/core/queue-processor.ts +197 -0
- package/src/core/state/checkpoints.ts +68 -0
- package/src/core/state/human.ts +176 -0
- package/src/core/state/index.ts +5 -0
- package/src/core/state/personas.ts +217 -0
- package/src/core/state/queue.ts +144 -0
- package/src/core/state-manager.ts +347 -0
- package/src/core/types.ts +421 -0
- package/src/core/utils/decay.ts +33 -0
- package/src/index.ts +1 -0
- package/src/integrations/opencode/importer.ts +896 -0
- package/src/integrations/opencode/index.ts +16 -0
- package/src/integrations/opencode/json-reader.ts +304 -0
- package/src/integrations/opencode/reader-factory.ts +35 -0
- package/src/integrations/opencode/sqlite-reader.ts +189 -0
- package/src/integrations/opencode/types.ts +244 -0
- package/src/prompts/AGENTS.md +62 -0
- package/src/prompts/ceremony/description-check.ts +47 -0
- package/src/prompts/ceremony/expire.ts +30 -0
- package/src/prompts/ceremony/explore.ts +60 -0
- package/src/prompts/ceremony/index.ts +11 -0
- package/src/prompts/ceremony/types.ts +42 -0
- package/src/prompts/generation/descriptions.ts +91 -0
- package/src/prompts/generation/index.ts +15 -0
- package/src/prompts/generation/persona.ts +155 -0
- package/src/prompts/generation/seeds.ts +31 -0
- package/src/prompts/generation/types.ts +47 -0
- package/src/prompts/heartbeat/check.ts +179 -0
- package/src/prompts/heartbeat/ei.ts +208 -0
- package/src/prompts/heartbeat/index.ts +15 -0
- package/src/prompts/heartbeat/types.ts +70 -0
- package/src/prompts/human/fact-scan.ts +152 -0
- package/src/prompts/human/index.ts +32 -0
- package/src/prompts/human/item-match.ts +74 -0
- package/src/prompts/human/item-update.ts +322 -0
- package/src/prompts/human/person-scan.ts +115 -0
- package/src/prompts/human/topic-scan.ts +135 -0
- package/src/prompts/human/trait-scan.ts +115 -0
- package/src/prompts/human/types.ts +127 -0
- package/src/prompts/index.ts +90 -0
- package/src/prompts/message-utils.ts +39 -0
- package/src/prompts/persona/index.ts +16 -0
- package/src/prompts/persona/topics-match.ts +69 -0
- package/src/prompts/persona/topics-scan.ts +98 -0
- package/src/prompts/persona/topics-update.ts +157 -0
- package/src/prompts/persona/traits.ts +117 -0
- package/src/prompts/persona/types.ts +74 -0
- package/src/prompts/response/index.ts +147 -0
- package/src/prompts/response/sections.ts +355 -0
- package/src/prompts/response/types.ts +38 -0
- package/src/prompts/validation/ei.ts +93 -0
- package/src/prompts/validation/index.ts +6 -0
- package/src/prompts/validation/types.ts +22 -0
- package/src/storage/crypto.ts +96 -0
- package/src/storage/index.ts +5 -0
- package/src/storage/interface.ts +9 -0
- package/src/storage/local.ts +79 -0
- package/src/storage/merge.ts +69 -0
- package/src/storage/remote.ts +145 -0
- package/src/templates/welcome.ts +91 -0
- package/tui/README.md +62 -0
- package/tui/bunfig.toml +4 -0
- package/tui/src/app.tsx +55 -0
- package/tui/src/commands/archive.tsx +93 -0
- package/tui/src/commands/context.tsx +124 -0
- package/tui/src/commands/delete.tsx +71 -0
- package/tui/src/commands/details.tsx +41 -0
- package/tui/src/commands/editor.tsx +46 -0
- package/tui/src/commands/help.tsx +12 -0
- package/tui/src/commands/me.tsx +145 -0
- package/tui/src/commands/model.ts +47 -0
- package/tui/src/commands/new.ts +31 -0
- package/tui/src/commands/pause.ts +46 -0
- package/tui/src/commands/persona.tsx +58 -0
- package/tui/src/commands/provider.tsx +124 -0
- package/tui/src/commands/quit.ts +22 -0
- package/tui/src/commands/quotes.tsx +172 -0
- package/tui/src/commands/registry.test.ts +137 -0
- package/tui/src/commands/registry.ts +130 -0
- package/tui/src/commands/resume.ts +39 -0
- package/tui/src/commands/setsync.tsx +43 -0
- package/tui/src/commands/settings.tsx +83 -0
- package/tui/src/components/ConfirmOverlay.tsx +51 -0
- package/tui/src/components/ConflictOverlay.tsx +78 -0
- package/tui/src/components/HelpOverlay.tsx +69 -0
- package/tui/src/components/Layout.tsx +24 -0
- package/tui/src/components/MessageList.tsx +174 -0
- package/tui/src/components/PersonaListOverlay.tsx +186 -0
- package/tui/src/components/PromptInput.tsx +145 -0
- package/tui/src/components/ProviderListOverlay.tsx +208 -0
- package/tui/src/components/QuotesOverlay.tsx +157 -0
- package/tui/src/components/Sidebar.tsx +95 -0
- package/tui/src/components/StatusBar.tsx +77 -0
- package/tui/src/components/WelcomeOverlay.tsx +73 -0
- package/tui/src/context/ei.tsx +623 -0
- package/tui/src/context/keyboard.tsx +164 -0
- package/tui/src/context/overlay.tsx +53 -0
- package/tui/src/index.tsx +8 -0
- package/tui/src/storage/file.ts +185 -0
- package/tui/src/util/duration.ts +32 -0
- package/tui/src/util/editor.ts +188 -0
- package/tui/src/util/logger.ts +109 -0
- package/tui/src/util/persona-editor.tsx +181 -0
- package/tui/src/util/provider-editor.tsx +168 -0
- package/tui/src/util/syntax.ts +35 -0
- package/tui/src/util/yaml-serializers.ts +755 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { PersonaEntity, Ei_Interface } from "../types.js";
|
|
2
|
+
import type { StateManager } from "../state-manager.js";
|
|
3
|
+
import type { IOpenCodeReader } from "../../integrations/opencode/types.js";
|
|
4
|
+
import { AGENT_ALIASES } from "../../integrations/opencode/types.js";
|
|
5
|
+
import { createOpenCodeReader } from "../../integrations/opencode/reader-factory.js";
|
|
6
|
+
|
|
7
|
+
const OPENCODE_GROUP = "OpenCode";
|
|
8
|
+
const TWELVE_HOURS_MS = 43200000;
|
|
9
|
+
|
|
10
|
+
export interface EnsureAgentPersonaOptions {
|
|
11
|
+
stateManager: StateManager;
|
|
12
|
+
interface?: Ei_Interface;
|
|
13
|
+
reader?: IOpenCodeReader;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function resolveCanonicalAgent(agentName: string): { canonical: string; aliases: string[] } {
|
|
17
|
+
for (const [canonical, variants] of Object.entries(AGENT_ALIASES)) {
|
|
18
|
+
if (variants.includes(agentName)) {
|
|
19
|
+
return { canonical, aliases: variants };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return { canonical: agentName, aliases: [agentName] };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function ensureAgentPersona(
|
|
26
|
+
agentName: string,
|
|
27
|
+
options: EnsureAgentPersonaOptions
|
|
28
|
+
): Promise<PersonaEntity> {
|
|
29
|
+
const { stateManager, interface: eiInterface, reader } = options;
|
|
30
|
+
|
|
31
|
+
const { canonical, aliases } = resolveCanonicalAgent(agentName);
|
|
32
|
+
|
|
33
|
+
const existing = stateManager.persona_getByName(canonical);
|
|
34
|
+
if (existing) {
|
|
35
|
+
return existing;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const agentReader = reader ?? await createOpenCodeReader();
|
|
39
|
+
const agentInfo = await agentReader.getAgentInfo(canonical);
|
|
40
|
+
|
|
41
|
+
const now = new Date().toISOString();
|
|
42
|
+
const personaId = crypto.randomUUID();
|
|
43
|
+
const persona: PersonaEntity = {
|
|
44
|
+
id: personaId,
|
|
45
|
+
display_name: canonical,
|
|
46
|
+
entity: "system",
|
|
47
|
+
aliases,
|
|
48
|
+
short_description: agentInfo?.description ?? "OpenCode coding agent",
|
|
49
|
+
long_description: "An OpenCode agent that assists with coding tasks.",
|
|
50
|
+
group_primary: OPENCODE_GROUP,
|
|
51
|
+
groups_visible: [OPENCODE_GROUP],
|
|
52
|
+
traits: [],
|
|
53
|
+
topics: [],
|
|
54
|
+
is_paused: false,
|
|
55
|
+
is_archived: false,
|
|
56
|
+
is_static: false,
|
|
57
|
+
heartbeat_delay_ms: TWELVE_HOURS_MS,
|
|
58
|
+
last_heartbeat: now,
|
|
59
|
+
last_updated: now,
|
|
60
|
+
last_activity: now,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
stateManager.persona_add(persona);
|
|
64
|
+
eiInterface?.onPersonaAdded?.();
|
|
65
|
+
|
|
66
|
+
return persona;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export async function ensureAllAgentPersonas(
|
|
70
|
+
agentNames: string[],
|
|
71
|
+
options: EnsureAgentPersonaOptions
|
|
72
|
+
): Promise<Map<string, PersonaEntity>> {
|
|
73
|
+
const result = new Map<string, PersonaEntity>();
|
|
74
|
+
|
|
75
|
+
for (const name of agentNames) {
|
|
76
|
+
const persona = await ensureAgentPersona(name, options);
|
|
77
|
+
result.set(name, persona);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return result;
|
|
81
|
+
}
|