@zhijiewang/openharness 2.1.0 → 2.3.1
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 +4 -4
- package/dist/DeferredTool.js +3 -1
- package/dist/Tool.d.ts +1 -1
- package/dist/agents/roles.js +58 -62
- package/dist/commands/cybergotchi.d.ts +1 -1
- package/dist/commands/cybergotchi.js +30 -30
- package/dist/commands/index.js +288 -132
- package/dist/components/App.d.ts +1 -1
- package/dist/components/App.js +6 -6
- package/dist/components/CompanionFooter.d.ts +1 -1
- package/dist/components/CompanionFooter.js +6 -8
- package/dist/components/CybergotchiBubble.js +5 -5
- package/dist/components/CybergotchiPanel.d.ts +1 -1
- package/dist/components/CybergotchiPanel.js +7 -7
- package/dist/components/CybergotchiPanelConnected.js +2 -2
- package/dist/components/CybergotchiSetup.js +26 -24
- package/dist/components/CybergotchiSprite.d.ts +1 -1
- package/dist/components/CybergotchiSprite.js +8 -12
- package/dist/components/DiffView.d.ts +1 -1
- package/dist/components/DiffView.js +10 -10
- package/dist/components/ErrorBoundary.d.ts +1 -1
- package/dist/components/ErrorBoundary.js +1 -1
- package/dist/components/InitWizard.js +65 -33
- package/dist/components/Markdown.js +2 -4
- package/dist/components/Messages.js +4 -4
- package/dist/components/PermissionPrompt.d.ts +1 -1
- package/dist/components/PermissionPrompt.js +15 -17
- package/dist/components/REPL.d.ts +1 -1
- package/dist/components/REPL.js +74 -49
- package/dist/components/Spinner.js +2 -2
- package/dist/components/TextInput.js +35 -29
- package/dist/components/ToolCallDisplay.js +3 -5
- package/dist/cybergotchi/bones.d.ts +1 -1
- package/dist/cybergotchi/bones.js +8 -8
- package/dist/cybergotchi/config.d.ts +2 -2
- package/dist/cybergotchi/config.js +13 -13
- package/dist/cybergotchi/events.d.ts +5 -5
- package/dist/cybergotchi/events.js +7 -7
- package/dist/cybergotchi/needs.d.ts +2 -2
- package/dist/cybergotchi/needs.js +7 -9
- package/dist/cybergotchi/personality.d.ts +2 -2
- package/dist/cybergotchi/personality.js +2 -2
- package/dist/cybergotchi/species.d.ts +1 -1
- package/dist/cybergotchi/species.js +145 -217
- package/dist/cybergotchi/speech.d.ts +2 -2
- package/dist/cybergotchi/speech.js +43 -43
- package/dist/cybergotchi/types.d.ts +4 -4
- package/dist/cybergotchi/types.js +26 -26
- package/dist/cybergotchi/useCybergotchi.d.ts +1 -1
- package/dist/cybergotchi/useCybergotchi.js +29 -25
- package/dist/git/index.js +11 -9
- package/dist/harness/checkpoints.js +29 -21
- package/dist/harness/config.d.ts +3 -3
- package/dist/harness/config.js +15 -9
- package/dist/harness/context-warning.d.ts +1 -1
- package/dist/harness/context-warning.js +1 -1
- package/dist/harness/cost.js +1 -1
- package/dist/harness/credentials.js +13 -13
- package/dist/harness/hooks.js +7 -5
- package/dist/harness/keybindings.js +20 -18
- package/dist/harness/marketplace.d.ts +3 -3
- package/dist/harness/marketplace.js +55 -42
- package/dist/harness/memory.d.ts +23 -5
- package/dist/harness/memory.js +142 -41
- package/dist/harness/onboarding.js +30 -10
- package/dist/harness/plugins.d.ts +9 -1
- package/dist/harness/plugins.js +54 -30
- package/dist/harness/rules.js +12 -7
- package/dist/harness/sandbox.js +15 -15
- package/dist/harness/session-db.d.ts +55 -0
- package/dist/harness/session-db.js +165 -0
- package/dist/harness/session.d.ts +1 -1
- package/dist/harness/session.js +34 -15
- package/dist/harness/store.d.ts +3 -3
- package/dist/harness/store.js +6 -4
- package/dist/harness/submit-handler.d.ts +4 -4
- package/dist/harness/submit-handler.js +25 -23
- package/dist/harness/telemetry.d.ts +1 -1
- package/dist/harness/telemetry.js +23 -19
- package/dist/harness/traces.d.ts +2 -2
- package/dist/harness/traces.js +39 -33
- package/dist/harness/verification.d.ts +1 -1
- package/dist/harness/verification.js +50 -44
- package/dist/lsp/client.js +44 -40
- package/dist/main.js +114 -59
- package/dist/mcp/DeferredMcpTool.d.ts +4 -4
- package/dist/mcp/DeferredMcpTool.js +9 -5
- package/dist/mcp/McpTool.d.ts +4 -4
- package/dist/mcp/McpTool.js +8 -4
- package/dist/mcp/client.d.ts +2 -2
- package/dist/mcp/client.js +21 -21
- package/dist/mcp/loader.d.ts +1 -1
- package/dist/mcp/loader.js +17 -12
- package/dist/mcp/registry.d.ts +3 -3
- package/dist/mcp/registry.js +97 -97
- package/dist/mcp/schema.d.ts +1 -1
- package/dist/mcp/schema.js +16 -16
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +21 -21
- package/dist/mcp/types.d.ts +3 -3
- package/dist/providers/anthropic.d.ts +2 -2
- package/dist/providers/anthropic.js +10 -9
- package/dist/providers/base.d.ts +1 -1
- package/dist/providers/index.js +10 -3
- package/dist/providers/llamacpp.d.ts +2 -2
- package/dist/providers/llamacpp.js +1 -3
- package/dist/providers/ollama.d.ts +2 -2
- package/dist/providers/ollama.js +3 -4
- package/dist/providers/openai.d.ts +2 -2
- package/dist/providers/openai.js +3 -5
- package/dist/providers/openrouter.d.ts +2 -2
- package/dist/providers/router.d.ts +1 -1
- package/dist/providers/router.js +7 -7
- package/dist/query/compress.d.ts +2 -2
- package/dist/query/compress.js +22 -21
- package/dist/query/context-manager.d.ts +1 -1
- package/dist/query/context-manager.js +5 -5
- package/dist/query/errors.js +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/query/index.js +42 -24
- package/dist/query/tools.js +15 -12
- package/dist/query/types.d.ts +3 -1
- package/dist/query.d.ts +1 -1
- package/dist/query.js +1 -1
- package/dist/remote/auth.d.ts +2 -2
- package/dist/remote/auth.js +8 -8
- package/dist/remote/server.d.ts +3 -3
- package/dist/remote/server.js +60 -60
- package/dist/renderer/cells.js +9 -9
- package/dist/renderer/colors.js +24 -6
- package/dist/renderer/diff.d.ts +2 -2
- package/dist/renderer/diff.js +27 -19
- package/dist/renderer/differ.d.ts +1 -1
- package/dist/renderer/differ.js +9 -9
- package/dist/renderer/image.js +19 -19
- package/dist/renderer/index.d.ts +6 -6
- package/dist/renderer/index.js +163 -93
- package/dist/renderer/input.js +66 -48
- package/dist/renderer/layout.d.ts +6 -6
- package/dist/renderer/layout.js +163 -124
- package/dist/renderer/markdown.d.ts +2 -2
- package/dist/renderer/markdown.js +173 -54
- package/dist/renderer/session-browser.d.ts +2 -2
- package/dist/renderer/session-browser.js +19 -21
- package/dist/repl.d.ts +5 -5
- package/dist/repl.js +311 -198
- package/dist/sdk/index.d.ts +5 -5
- package/dist/sdk/index.js +32 -26
- package/dist/services/AgentDispatcher.d.ts +3 -3
- package/dist/services/AgentDispatcher.js +33 -29
- package/dist/services/CronExecutor.d.ts +4 -4
- package/dist/services/CronExecutor.js +12 -8
- package/dist/services/EvaluatorLoop.d.ts +3 -3
- package/dist/services/EvaluatorLoop.js +29 -21
- package/dist/services/MetaHarness.d.ts +1 -1
- package/dist/services/MetaHarness.js +34 -32
- package/dist/services/PipelineExecutor.d.ts +1 -1
- package/dist/services/PipelineExecutor.js +23 -25
- package/dist/services/SkillExtractor.d.ts +43 -0
- package/dist/services/SkillExtractor.js +163 -0
- package/dist/services/StreamingToolExecutor.d.ts +2 -2
- package/dist/services/StreamingToolExecutor.js +11 -7
- package/dist/services/a2a.d.ts +8 -8
- package/dist/services/a2a.js +44 -34
- package/dist/services/agent-messaging.d.ts +33 -15
- package/dist/services/agent-messaging.js +65 -13
- package/dist/services/cron.js +16 -16
- package/dist/tools/AgentTool/index.d.ts +5 -2
- package/dist/tools/AgentTool/index.js +25 -39
- package/dist/tools/AskUserTool/index.js +1 -1
- package/dist/tools/BashTool/index.d.ts +2 -2
- package/dist/tools/BashTool/index.js +18 -10
- package/dist/tools/CronTool/index.js +30 -12
- package/dist/tools/DiagnosticsTool/index.js +28 -22
- package/dist/tools/EnterPlanModeTool/index.js +93 -14
- package/dist/tools/EnterWorktreeTool/index.js +7 -3
- package/dist/tools/ExitPlanModeTool/index.d.ts +22 -1
- package/dist/tools/ExitPlanModeTool/index.js +20 -5
- package/dist/tools/ExitWorktreeTool/index.js +11 -4
- package/dist/tools/FileEditTool/index.js +3 -5
- package/dist/tools/FileReadTool/index.js +16 -10
- package/dist/tools/FileWriteTool/index.js +2 -2
- package/dist/tools/GlobTool/index.js +5 -9
- package/dist/tools/GrepTool/index.d.ts +2 -2
- package/dist/tools/GrepTool/index.js +14 -9
- package/dist/tools/ImageReadTool/index.js +2 -2
- package/dist/tools/KillProcessTool/index.js +11 -7
- package/dist/tools/LSTool/index.js +3 -3
- package/dist/tools/MemoryTool/index.d.ts +5 -5
- package/dist/tools/MemoryTool/index.js +28 -14
- package/dist/tools/MonitorTool/index.js +24 -19
- package/dist/tools/MultiEditTool/index.js +9 -5
- package/dist/tools/NotebookEditTool/index.js +3 -3
- package/dist/tools/ParallelAgentTool/index.d.ts +4 -4
- package/dist/tools/ParallelAgentTool/index.js +12 -6
- package/dist/tools/PipelineTool/index.js +3 -3
- package/dist/tools/PowerShellTool/index.js +10 -6
- package/dist/tools/RemoteTriggerTool/index.js +8 -4
- package/dist/tools/ScheduleWakeupTool/index.d.ts +42 -0
- package/dist/tools/ScheduleWakeupTool/index.js +115 -0
- package/dist/tools/SendMessageTool/index.js +25 -7
- package/dist/tools/SessionSearchTool/index.d.ts +15 -0
- package/dist/tools/SessionSearchTool/index.js +36 -0
- package/dist/tools/SkillTool/index.d.ts +3 -0
- package/dist/tools/SkillTool/index.js +39 -9
- package/dist/tools/TaskCreateTool/index.d.ts +2 -2
- package/dist/tools/TaskCreateTool/index.js +2 -2
- package/dist/tools/TaskGetTool/index.js +2 -2
- package/dist/tools/TaskListTool/index.js +3 -5
- package/dist/tools/TaskOutputTool/index.js +2 -2
- package/dist/tools/TaskStopTool/index.js +3 -3
- package/dist/tools/TaskUpdateTool/index.d.ts +4 -4
- package/dist/tools/TaskUpdateTool/index.js +2 -2
- package/dist/tools/ToolSearchTool/index.js +9 -6
- package/dist/tools/WebFetchTool/index.js +1 -1
- package/dist/tools/WebSearchTool/index.js +2 -6
- package/dist/tools.js +31 -30
- package/dist/types/permissions.js +15 -9
- package/dist/utils/bash-safety.d.ts +1 -1
- package/dist/utils/bash-safety.js +64 -54
- package/dist/utils/diff-algorithm.d.ts +3 -3
- package/dist/utils/diff-algorithm.js +7 -7
- package/dist/utils/fs.js +3 -3
- package/dist/utils/safe-env.js +1 -1
- package/dist/utils/theme-data.d.ts +1 -1
- package/dist/utils/theme-data.js +1 -1
- package/dist/utils/theme.d.ts +1 -1
- package/dist/utils/theme.js +1 -1
- package/dist/utils/tool-summary.d.ts +1 -1
- package/dist/utils/tool-summary.js +27 -9
- package/package.json +10 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompanionConfig, CompanionRuntime } from
|
|
1
|
+
import type { CompanionConfig, CompanionRuntime } from "./types.js";
|
|
2
2
|
export declare function loadCompanionConfig(): CompanionConfig | null;
|
|
3
3
|
export declare function saveCompanionConfig(config: CompanionConfig): void;
|
|
4
4
|
/** Load config + recompute bones from seed → runtime */
|
|
@@ -11,5 +11,5 @@ export declare function getCompanionSystemPrompt(runtime: CompanionRuntime): str
|
|
|
11
11
|
export declare function companionReservedColumns(hasCompanion: boolean, hasSpeech: boolean): number;
|
|
12
12
|
export declare const loadCybergotchiConfig: typeof loadCompanionConfig;
|
|
13
13
|
export declare const saveCybergotchiConfig: typeof saveCompanionConfig;
|
|
14
|
-
export declare function defaultConfig(
|
|
14
|
+
export declare function defaultConfig(_species: string, name: string): CompanionConfig;
|
|
15
15
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
const CONFIG_DIR = join(homedir(),
|
|
7
|
-
const CONFIG_PATH = join(CONFIG_DIR,
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { getDefaultSeed, roll } from "./bones.js";
|
|
5
|
+
import { DEFAULT_LIFETIME, DEFAULT_NEEDS } from "./types.js";
|
|
6
|
+
const CONFIG_DIR = join(homedir(), ".oh");
|
|
7
|
+
const CONFIG_PATH = join(CONFIG_DIR, "cybergotchi.json");
|
|
8
8
|
export function loadCompanionConfig() {
|
|
9
9
|
if (!existsSync(CONFIG_PATH))
|
|
10
10
|
return null;
|
|
11
11
|
try {
|
|
12
|
-
const raw = readFileSync(CONFIG_PATH,
|
|
12
|
+
const raw = readFileSync(CONFIG_PATH, "utf-8");
|
|
13
13
|
const cfg = JSON.parse(raw);
|
|
14
14
|
// Fill in defaults for fields added after initial setup
|
|
15
15
|
if (!cfg.seed)
|
|
@@ -18,9 +18,9 @@ export function loadCompanionConfig() {
|
|
|
18
18
|
// Migrate from old CybergotchiConfig format
|
|
19
19
|
const old = cfg;
|
|
20
20
|
cfg.soul = {
|
|
21
|
-
name: old.name ||
|
|
22
|
-
personality:
|
|
23
|
-
hat: old.hat ||
|
|
21
|
+
name: old.name || "Companion",
|
|
22
|
+
personality: "",
|
|
23
|
+
hat: old.hat || "none",
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
if (!cfg.needs)
|
|
@@ -95,7 +95,7 @@ export function companionReservedColumns(hasCompanion, hasSpeech) {
|
|
|
95
95
|
// Legacy aliases for gradual migration
|
|
96
96
|
export const loadCybergotchiConfig = loadCompanionConfig;
|
|
97
97
|
export const saveCybergotchiConfig = saveCompanionConfig;
|
|
98
|
-
export function defaultConfig(
|
|
99
|
-
return createCompanionConfig(getDefaultSeed(), name,
|
|
98
|
+
export function defaultConfig(_species, name) {
|
|
99
|
+
return createCompanionConfig(getDefaultSeed(), name, "", "none");
|
|
100
100
|
}
|
|
101
101
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { EventEmitter } from
|
|
2
|
-
export type CybergotchiEventType =
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
export type CybergotchiEventType = "toolError" | "toolSuccess" | "longWait" | "commit" | "taskComplete" | "userAddressed" | "idle";
|
|
3
3
|
export interface CybergotchiEvent {
|
|
4
4
|
type: CybergotchiEventType;
|
|
5
5
|
toolName?: string;
|
|
6
6
|
text?: string;
|
|
7
7
|
}
|
|
8
8
|
declare class CybergotchiEventEmitter extends EventEmitter {
|
|
9
|
-
emit(
|
|
10
|
-
on(
|
|
11
|
-
off(
|
|
9
|
+
emit(_event: "cybergotchi", data: CybergotchiEvent): boolean;
|
|
10
|
+
on(_event: "cybergotchi", listener: (data: CybergotchiEvent) => void): this;
|
|
11
|
+
off(_event: "cybergotchi", listener: (data: CybergotchiEvent) => void): this;
|
|
12
12
|
}
|
|
13
13
|
export declare const cybergotchiEvents: CybergotchiEventEmitter;
|
|
14
14
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { EventEmitter } from
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
2
|
class CybergotchiEventEmitter extends EventEmitter {
|
|
3
|
-
emit(
|
|
4
|
-
return super.emit(
|
|
3
|
+
emit(_event, data) {
|
|
4
|
+
return super.emit("cybergotchi", data);
|
|
5
5
|
}
|
|
6
|
-
on(
|
|
7
|
-
return super.on(
|
|
6
|
+
on(_event, listener) {
|
|
7
|
+
return super.on("cybergotchi", listener);
|
|
8
8
|
}
|
|
9
|
-
off(
|
|
10
|
-
return super.off(
|
|
9
|
+
off(_event, listener) {
|
|
10
|
+
return super.off("cybergotchi", listener);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
export const cybergotchiEvents = new CybergotchiEventEmitter();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { CybergotchiEventType } from "./events.js";
|
|
2
|
+
import type { CompanionConfig, Needs } from "./types.js";
|
|
3
3
|
/** Apply time-based decay since needsUpdatedAt. Mutates config.needs in place. */
|
|
4
4
|
export declare function decayNeeds(config: CompanionConfig): void;
|
|
5
5
|
/** Apply an instant delta to a specific need. */
|
|
@@ -44,28 +44,28 @@ export function applyEvent(config, type) {
|
|
|
44
44
|
}
|
|
45
45
|
let milestoneSpeech = null;
|
|
46
46
|
// Streak tracking
|
|
47
|
-
if (type ===
|
|
47
|
+
if (type === "toolSuccess") {
|
|
48
48
|
config.currentStreak += 1;
|
|
49
49
|
if (config.currentStreak > config.lifetime.longestStreak) {
|
|
50
50
|
config.lifetime.longestStreak = config.currentStreak;
|
|
51
51
|
if (STREAK_MILESTONES.includes(config.currentStreak)) {
|
|
52
52
|
milestoneSpeech = `🔥 ${config.currentStreak} streak! New record!`;
|
|
53
|
-
process.stdout.write(
|
|
53
|
+
process.stdout.write("\x07"); // terminal bell
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
else if (STREAK_MILESTONES.includes(config.currentStreak)) {
|
|
57
57
|
milestoneSpeech = `🔥 ${config.currentStreak} in a row!`;
|
|
58
|
-
process.stdout.write(
|
|
58
|
+
process.stdout.write("\x07");
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
else if (type ===
|
|
61
|
+
else if (type === "toolError") {
|
|
62
62
|
config.currentStreak = 0;
|
|
63
63
|
config.lifetime.totalErrors += 1;
|
|
64
64
|
}
|
|
65
|
-
else if (type ===
|
|
65
|
+
else if (type === "commit") {
|
|
66
66
|
config.lifetime.totalCommits += 1;
|
|
67
67
|
}
|
|
68
|
-
else if (type ===
|
|
68
|
+
else if (type === "taskComplete") {
|
|
69
69
|
config.lifetime.totalTasksCompleted += 1;
|
|
70
70
|
}
|
|
71
71
|
// Evolution check
|
|
@@ -74,9 +74,7 @@ export function applyEvent(config, type) {
|
|
|
74
74
|
const newStage = stage2 ? 2 : stage1 ? 1 : 0;
|
|
75
75
|
if (newStage > config.evolutionStage) {
|
|
76
76
|
config.evolutionStage = newStage;
|
|
77
|
-
milestoneSpeech = newStage === 2
|
|
78
|
-
? "LEGENDARY FORM UNLOCKED!"
|
|
79
|
-
: "I'm... evolving?!";
|
|
77
|
+
milestoneSpeech = newStage === 2 ? "LEGENDARY FORM UNLOCKED!" : "I'm... evolving?!";
|
|
80
78
|
}
|
|
81
79
|
return milestoneSpeech;
|
|
82
80
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Provider } from
|
|
2
|
-
import type { CompanionBones } from
|
|
1
|
+
import type { Provider } from "../providers/base.js";
|
|
2
|
+
import type { CompanionBones } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Generate a name and personality description for a companion using the LLM.
|
|
5
5
|
* Returns { name, personality } or null if generation fails.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createUserMessage } from
|
|
1
|
+
import { createUserMessage } from "../types/message.js";
|
|
2
2
|
/**
|
|
3
3
|
* Generate a name and personality description for a companion using the LLM.
|
|
4
4
|
* Returns { name, personality } or null if generation fails.
|
|
@@ -7,7 +7,7 @@ export async function generatePersonality(provider, bones, model) {
|
|
|
7
7
|
const prompt = `Generate a name and 2-sentence personality for a ${bones.species} coding companion with these traits: DEBUGGING:${bones.baseStats.DEBUGGING}, PATIENCE:${bones.baseStats.PATIENCE}, CHAOS:${bones.baseStats.CHAOS}, WISDOM:${bones.baseStats.WISDOM}, SNARK:${bones.baseStats.SNARK}. Rarity: ${bones.rarity}. Keep it fun and concise. Respond in JSON format: {"name": "...", "personality": "..."}`;
|
|
8
8
|
try {
|
|
9
9
|
const messages = [createUserMessage(prompt)];
|
|
10
|
-
const response = await provider.complete(messages,
|
|
10
|
+
const response = await provider.complete(messages, "You are a creative naming assistant. Respond only with the requested JSON.", undefined, model);
|
|
11
11
|
const text = response.content.trim();
|
|
12
12
|
// Try to parse JSON from response
|
|
13
13
|
const jsonMatch = text.match(/\{[\s\S]*\}/);
|