overarch-linux-x64 0.8.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/LICENSE +21 -0
- package/README.md +214 -0
- package/dist/bin/overarch.d.ts +2 -0
- package/dist/bin/overarch.js +178 -0
- package/dist/src/agent/context.d.ts +14 -0
- package/dist/src/agent/context.js +200 -0
- package/dist/src/agent/context_compressor.d.ts +21 -0
- package/dist/src/agent/context_compressor.js +90 -0
- package/dist/src/agent/manifest.d.ts +22 -0
- package/dist/src/agent/manifest.js +131 -0
- package/dist/src/agent/planner.d.ts +38 -0
- package/dist/src/agent/planner.js +118 -0
- package/dist/src/agent/runtime.d.ts +59 -0
- package/dist/src/agent/runtime.js +400 -0
- package/dist/src/cli/approval.d.ts +13 -0
- package/dist/src/cli/approval.js +71 -0
- package/dist/src/cli/args.d.ts +15 -0
- package/dist/src/cli/args.js +47 -0
- package/dist/src/cli/commands/audit.d.ts +10 -0
- package/dist/src/cli/commands/audit.js +79 -0
- package/dist/src/cli/commands/companion.d.ts +1 -0
- package/dist/src/cli/commands/companion.js +143 -0
- package/dist/src/cli/commands/config.d.ts +1 -0
- package/dist/src/cli/commands/config.js +135 -0
- package/dist/src/cli/commands/doctor.d.ts +1 -0
- package/dist/src/cli/commands/doctor.js +217 -0
- package/dist/src/cli/commands/init.d.ts +1 -0
- package/dist/src/cli/commands/init.js +134 -0
- package/dist/src/cli/commands/memory.d.ts +2 -0
- package/dist/src/cli/commands/memory.js +98 -0
- package/dist/src/cli/commands/onboarding.d.ts +3 -0
- package/dist/src/cli/commands/onboarding.js +223 -0
- package/dist/src/cli/commands/sessions.d.ts +1 -0
- package/dist/src/cli/commands/sessions.js +22 -0
- package/dist/src/cli/commands/status.d.ts +1 -0
- package/dist/src/cli/commands/status.js +37 -0
- package/dist/src/cli/commands/update.d.ts +9 -0
- package/dist/src/cli/commands/update.js +105 -0
- package/dist/src/cli/repl.d.ts +3 -0
- package/dist/src/cli/repl.js +821 -0
- package/dist/src/cli/ui.d.ts +53 -0
- package/dist/src/cli/ui.js +215 -0
- package/dist/src/companion/petdex_adapter.d.ts +31 -0
- package/dist/src/companion/petdex_adapter.js +171 -0
- package/dist/src/companion/petdex_bridge.d.ts +65 -0
- package/dist/src/companion/petdex_bridge.js +356 -0
- package/dist/src/companion/types.d.ts +57 -0
- package/dist/src/companion/types.js +11 -0
- package/dist/src/config/index.d.ts +24 -0
- package/dist/src/config/index.js +237 -0
- package/dist/src/config/types.d.ts +58 -0
- package/dist/src/config/types.js +7 -0
- package/dist/src/core/diagnostics.d.ts +48 -0
- package/dist/src/core/diagnostics.js +115 -0
- package/dist/src/core/index.d.ts +23 -0
- package/dist/src/core/index.js +23 -0
- package/dist/src/core/mission.d.ts +55 -0
- package/dist/src/core/mission.js +173 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/learning/memory_manager.d.ts +26 -0
- package/dist/src/learning/memory_manager.js +211 -0
- package/dist/src/learning/types.d.ts +54 -0
- package/dist/src/learning/types.js +1 -0
- package/dist/src/mcp/registry.d.ts +17 -0
- package/dist/src/mcp/registry.js +97 -0
- package/dist/src/mcp/types.d.ts +13 -0
- package/dist/src/mcp/types.js +1 -0
- package/dist/src/providers/anthropic.d.ts +10 -0
- package/dist/src/providers/anthropic.js +95 -0
- package/dist/src/providers/base.d.ts +15 -0
- package/dist/src/providers/base.js +108 -0
- package/dist/src/providers/factory.d.ts +28 -0
- package/dist/src/providers/factory.js +142 -0
- package/dist/src/providers/gemini.d.ts +10 -0
- package/dist/src/providers/gemini.js +97 -0
- package/dist/src/providers/openai.d.ts +9 -0
- package/dist/src/providers/openai.js +85 -0
- package/dist/src/providers/openrouter.d.ts +5 -0
- package/dist/src/providers/openrouter.js +14 -0
- package/dist/src/providers/registry.d.ts +19 -0
- package/dist/src/providers/registry.js +209 -0
- package/dist/src/providers/types.d.ts +59 -0
- package/dist/src/providers/types.js +1 -0
- package/dist/src/providers/validator.d.ts +24 -0
- package/dist/src/providers/validator.js +161 -0
- package/dist/src/security/audit.d.ts +56 -0
- package/dist/src/security/audit.js +154 -0
- package/dist/src/security/guardrails.d.ts +9 -0
- package/dist/src/security/guardrails.js +32 -0
- package/dist/src/security/permissions.d.ts +12 -0
- package/dist/src/security/permissions.js +68 -0
- package/dist/src/security/policy.d.ts +220 -0
- package/dist/src/security/policy.js +720 -0
- package/dist/src/session/manager.d.ts +22 -0
- package/dist/src/session/manager.js +172 -0
- package/dist/src/session/types.d.ts +36 -0
- package/dist/src/session/types.js +1 -0
- package/dist/src/tools/checkpoint.d.ts +26 -0
- package/dist/src/tools/checkpoint.js +160 -0
- package/dist/src/tools/diagnostics.d.ts +2 -0
- package/dist/src/tools/diagnostics.js +125 -0
- package/dist/src/tools/diff.d.ts +14 -0
- package/dist/src/tools/diff.js +124 -0
- package/dist/src/tools/filesystem.d.ts +2 -0
- package/dist/src/tools/filesystem.js +224 -0
- package/dist/src/tools/git.d.ts +2 -0
- package/dist/src/tools/git.js +138 -0
- package/dist/src/tools/markdown.d.ts +33 -0
- package/dist/src/tools/markdown.js +190 -0
- package/dist/src/tools/project.d.ts +2 -0
- package/dist/src/tools/project.js +63 -0
- package/dist/src/tools/registry.d.ts +14 -0
- package/dist/src/tools/registry.js +230 -0
- package/dist/src/tools/search.d.ts +2 -0
- package/dist/src/tools/search.js +136 -0
- package/dist/src/tools/shell.d.ts +2 -0
- package/dist/src/tools/shell.js +74 -0
- package/dist/src/tools/symbols.d.ts +30 -0
- package/dist/src/tools/symbols.js +155 -0
- package/dist/src/tools/types.d.ts +28 -0
- package/dist/src/tools/types.js +1 -0
- package/dist/src/tools/web_search.d.ts +14 -0
- package/dist/src/tools/web_search.js +154 -0
- package/install.sh +29 -0
- package/overarch +15 -0
- package/package.json +28 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare enum PermissionTier {
|
|
2
|
+
ReadOnly = "read-only",
|
|
3
|
+
SafeMutation = "safe-mutation",
|
|
4
|
+
StateMutating = "state-mutating",
|
|
5
|
+
Destructive = "destructive"
|
|
6
|
+
}
|
|
7
|
+
export type ProviderAuthMethod = 'env' | 'dotenv' | 'offline';
|
|
8
|
+
export interface ProviderConfig {
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
models?: string[];
|
|
12
|
+
authMethod?: ProviderAuthMethod;
|
|
13
|
+
}
|
|
14
|
+
export interface PermissionConfig {
|
|
15
|
+
autoApprove: PermissionTier[];
|
|
16
|
+
requireApproval: PermissionTier[];
|
|
17
|
+
deny: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface ContextConfig {
|
|
20
|
+
maxTokens: number;
|
|
21
|
+
maxFileSize: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ProjectConfig {
|
|
24
|
+
include: string[];
|
|
25
|
+
exclude: string[];
|
|
26
|
+
instructions: string;
|
|
27
|
+
}
|
|
28
|
+
export interface UIConfig {
|
|
29
|
+
accentColor: string;
|
|
30
|
+
avatar: string;
|
|
31
|
+
verbosity: 'quiet' | 'normal' | 'verbose';
|
|
32
|
+
}
|
|
33
|
+
export interface OnboardingState {
|
|
34
|
+
completed: boolean;
|
|
35
|
+
completedAt?: string;
|
|
36
|
+
version: string;
|
|
37
|
+
}
|
|
38
|
+
export type AgentAutonomyMode = 'autonomous' | 'approval' | 'plan';
|
|
39
|
+
export type PonytailIntensity = 'lite' | 'full' | 'ultra';
|
|
40
|
+
export type CcssMode = 'auto' | 'master' | 'god' | 'control';
|
|
41
|
+
export interface OverarchConfig {
|
|
42
|
+
providers: Record<string, ProviderConfig>;
|
|
43
|
+
activeProvider?: string;
|
|
44
|
+
defaultModel: string;
|
|
45
|
+
mode: 'online' | 'offline';
|
|
46
|
+
agentMode: AgentAutonomyMode;
|
|
47
|
+
ponytail: PonytailIntensity;
|
|
48
|
+
ccss: CcssMode;
|
|
49
|
+
permissions: PermissionConfig;
|
|
50
|
+
context: ContextConfig;
|
|
51
|
+
project: ProjectConfig;
|
|
52
|
+
ui: UIConfig;
|
|
53
|
+
onboarding: OnboardingState;
|
|
54
|
+
}
|
|
55
|
+
export type ResolvedConfig = OverarchConfig & {
|
|
56
|
+
configPath: string;
|
|
57
|
+
isProjectConfig: boolean;
|
|
58
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var PermissionTier;
|
|
2
|
+
(function (PermissionTier) {
|
|
3
|
+
PermissionTier["ReadOnly"] = "read-only";
|
|
4
|
+
PermissionTier["SafeMutation"] = "safe-mutation";
|
|
5
|
+
PermissionTier["StateMutating"] = "state-mutating";
|
|
6
|
+
PermissionTier["Destructive"] = "destructive";
|
|
7
|
+
})(PermissionTier || (PermissionTier = {}));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { RepoManifest } from '../agent/manifest.js';
|
|
2
|
+
import { ProjectContextInspection } from '../agent/context.js';
|
|
3
|
+
export interface CrashReport {
|
|
4
|
+
id: string;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
subsystem: string;
|
|
7
|
+
errorMessage: string;
|
|
8
|
+
sanitizedStack?: string;
|
|
9
|
+
environment: {
|
|
10
|
+
node: string;
|
|
11
|
+
platform: string;
|
|
12
|
+
arch: string;
|
|
13
|
+
memoryFreeMb: number;
|
|
14
|
+
memoryTotalMb: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface ProjectHealthReport {
|
|
18
|
+
projectDir: string;
|
|
19
|
+
manifest: RepoManifest;
|
|
20
|
+
context: ProjectContextInspection;
|
|
21
|
+
git: {
|
|
22
|
+
isGit: boolean;
|
|
23
|
+
branch?: string;
|
|
24
|
+
dirtyFilesCount: number;
|
|
25
|
+
statusSummary: string;
|
|
26
|
+
};
|
|
27
|
+
providers: {
|
|
28
|
+
activeProvider: string;
|
|
29
|
+
resolvedModel: string;
|
|
30
|
+
hasKey: boolean;
|
|
31
|
+
availableProviders: string[];
|
|
32
|
+
};
|
|
33
|
+
toolsCount: number;
|
|
34
|
+
healthScore: 'healthy' | 'warning' | 'needs_setup';
|
|
35
|
+
recommendations: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Redacts API keys, bearer tokens, secrets, and auth strings from logs or displays
|
|
39
|
+
*/
|
|
40
|
+
export declare function redactSecrets(input: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Creates structured crash diagnostics with secret redaction
|
|
43
|
+
*/
|
|
44
|
+
export declare function createCrashReport(subsystem: string, error: Error): CrashReport;
|
|
45
|
+
/**
|
|
46
|
+
* Performs comprehensive project health audit
|
|
47
|
+
*/
|
|
48
|
+
export declare function inspectProjectHealth(cwd?: string): Promise<ProjectHealthReport>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as os from 'node:os';
|
|
2
|
+
import { exec } from 'node:child_process';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { buildRepoManifest } from '../agent/manifest.js';
|
|
5
|
+
import { inspectProjectContext } from '../agent/context.js';
|
|
6
|
+
import { loadConfig, getApiKey } from '../config/index.js';
|
|
7
|
+
import { ToolRegistry } from '../tools/registry.js';
|
|
8
|
+
import { resolveModel } from '../providers/factory.js';
|
|
9
|
+
const execAsync = promisify(exec);
|
|
10
|
+
/**
|
|
11
|
+
* Redacts API keys, bearer tokens, secrets, and auth strings from logs or displays
|
|
12
|
+
*/
|
|
13
|
+
export function redactSecrets(input) {
|
|
14
|
+
if (!input)
|
|
15
|
+
return '';
|
|
16
|
+
return input
|
|
17
|
+
.replace(/(sk-[a-zA-Z0-9_\-]{8,})/g, (m) => m.slice(0, 4) + '...' + '[REDACTED]')
|
|
18
|
+
.replace(/(Bearer\s+)[a-zA-Z0-9_\-\.]{8,}/gi, '$1[REDACTED]')
|
|
19
|
+
.replace(/(apiKey["':\s=]+)(["'])[a-zA-Z0-9_\-]{8,}(["'])/gi, '$1$2[REDACTED]$3')
|
|
20
|
+
.replace(/([A-Z0-9_]*KEY["':\s=]+)(["'])[a-zA-Z0-9_\-]{8,}(["'])/gi, '$1$2[REDACTED]$3')
|
|
21
|
+
.replace(/(ghp_[a-zA-Z0-9]{20,})/g, 'ghp_[REDACTED]');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates structured crash diagnostics with secret redaction
|
|
25
|
+
*/
|
|
26
|
+
export function createCrashReport(subsystem, error) {
|
|
27
|
+
const sanitizedStack = error.stack ? redactSecrets(error.stack) : undefined;
|
|
28
|
+
const sanitizedMessage = redactSecrets(error.message);
|
|
29
|
+
return {
|
|
30
|
+
id: `crash_${Date.now()}`,
|
|
31
|
+
timestamp: new Date().toISOString(),
|
|
32
|
+
subsystem,
|
|
33
|
+
errorMessage: sanitizedMessage,
|
|
34
|
+
sanitizedStack,
|
|
35
|
+
environment: {
|
|
36
|
+
node: process.version,
|
|
37
|
+
platform: process.platform,
|
|
38
|
+
arch: process.arch,
|
|
39
|
+
memoryFreeMb: Math.round(os.freemem() / (1024 * 1024)),
|
|
40
|
+
memoryTotalMb: Math.round(os.totalmem() / (1024 * 1024)),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Performs comprehensive project health audit
|
|
46
|
+
*/
|
|
47
|
+
export async function inspectProjectHealth(cwd = process.cwd()) {
|
|
48
|
+
const manifest = await buildRepoManifest(cwd);
|
|
49
|
+
const context = await inspectProjectContext(cwd);
|
|
50
|
+
const config = await loadConfig();
|
|
51
|
+
const tools = ToolRegistry.createDefault().list();
|
|
52
|
+
let isGit = false;
|
|
53
|
+
let branch;
|
|
54
|
+
let dirtyFilesCount = 0;
|
|
55
|
+
let statusSummary = 'Not a git repository';
|
|
56
|
+
try {
|
|
57
|
+
const { stdout: isGitOut } = await execAsync('git rev-parse --is-inside-work-tree', { cwd });
|
|
58
|
+
if (isGitOut.trim() === 'true') {
|
|
59
|
+
isGit = true;
|
|
60
|
+
const { stdout: bOut } = await execAsync('git rev-parse --abbrev-ref HEAD', { cwd });
|
|
61
|
+
branch = bOut.trim();
|
|
62
|
+
const { stdout: sOut } = await execAsync('git status --porcelain', { cwd });
|
|
63
|
+
const lines = sOut.trim().split('\n').filter(Boolean);
|
|
64
|
+
dirtyFilesCount = lines.length;
|
|
65
|
+
statusSummary = dirtyFilesCount === 0 ? 'Clean working tree' : `${dirtyFilesCount} uncommitted changes`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch { }
|
|
69
|
+
const activeProvider = config.activeProvider || 'anthropic';
|
|
70
|
+
const resolved = resolveModel(config.defaultModel);
|
|
71
|
+
const hasKey = !!getApiKey(resolved?.provider || activeProvider);
|
|
72
|
+
const availableProviders = [];
|
|
73
|
+
for (const p of ['anthropic', 'openai', 'gemini', 'openrouter']) {
|
|
74
|
+
if (getApiKey(p) || config.providers[p]?.apiKey) {
|
|
75
|
+
availableProviders.push(p);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const recommendations = [];
|
|
79
|
+
if (!isGit) {
|
|
80
|
+
recommendations.push('Initialize git repository with `git init` to enable checkpoints and diff tracking.');
|
|
81
|
+
}
|
|
82
|
+
if (!hasKey && config.mode !== 'offline') {
|
|
83
|
+
recommendations.push(`Configure API key for ${activeProvider.toUpperCase()} in Settings or .env.`);
|
|
84
|
+
}
|
|
85
|
+
if (manifest.testDirectories.length === 0) {
|
|
86
|
+
recommendations.push('Add tests to your project to enable autonomous verification.');
|
|
87
|
+
}
|
|
88
|
+
let healthScore = 'healthy';
|
|
89
|
+
if (recommendations.length >= 2 || (!hasKey && config.mode !== 'offline')) {
|
|
90
|
+
healthScore = 'needs_setup';
|
|
91
|
+
}
|
|
92
|
+
else if (recommendations.length > 0) {
|
|
93
|
+
healthScore = 'warning';
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
projectDir: cwd,
|
|
97
|
+
manifest,
|
|
98
|
+
context,
|
|
99
|
+
git: {
|
|
100
|
+
isGit,
|
|
101
|
+
branch,
|
|
102
|
+
dirtyFilesCount,
|
|
103
|
+
statusSummary,
|
|
104
|
+
},
|
|
105
|
+
providers: {
|
|
106
|
+
activeProvider,
|
|
107
|
+
resolvedModel: resolved ? resolved.displayName : config.defaultModel,
|
|
108
|
+
hasKey,
|
|
109
|
+
availableProviders,
|
|
110
|
+
},
|
|
111
|
+
toolsCount: tools.length,
|
|
112
|
+
healthScore,
|
|
113
|
+
recommendations,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from './mission.js';
|
|
2
|
+
export * from './diagnostics.js';
|
|
3
|
+
export * from '../agent/runtime.js';
|
|
4
|
+
export * from '../agent/planner.js';
|
|
5
|
+
export * from '../agent/manifest.js';
|
|
6
|
+
export * from '../agent/context.js';
|
|
7
|
+
export * from '../agent/context_compressor.js';
|
|
8
|
+
export * from '../session/manager.js';
|
|
9
|
+
export * from '../session/types.js';
|
|
10
|
+
export * from '../config/index.js';
|
|
11
|
+
export * from '../config/types.js';
|
|
12
|
+
export * from '../tools/registry.js';
|
|
13
|
+
export * from '../tools/checkpoint.js';
|
|
14
|
+
export * from '../tools/markdown.js';
|
|
15
|
+
export * from '../tools/symbols.js';
|
|
16
|
+
export * from '../tools/types.js';
|
|
17
|
+
export * from '../providers/types.js';
|
|
18
|
+
export * from '../providers/factory.js';
|
|
19
|
+
export * from '../providers/validator.js';
|
|
20
|
+
export * from '../security/permissions.js';
|
|
21
|
+
export * from '../security/guardrails.js';
|
|
22
|
+
export * from '../companion/types.js';
|
|
23
|
+
export * from '../companion/petdex_bridge.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from './mission.js';
|
|
2
|
+
export * from './diagnostics.js';
|
|
3
|
+
export * from '../agent/runtime.js';
|
|
4
|
+
export * from '../agent/planner.js';
|
|
5
|
+
export * from '../agent/manifest.js';
|
|
6
|
+
export * from '../agent/context.js';
|
|
7
|
+
export * from '../agent/context_compressor.js';
|
|
8
|
+
export * from '../session/manager.js';
|
|
9
|
+
export * from '../session/types.js';
|
|
10
|
+
export * from '../config/index.js';
|
|
11
|
+
export * from '../config/types.js';
|
|
12
|
+
export * from '../tools/registry.js';
|
|
13
|
+
export * from '../tools/checkpoint.js';
|
|
14
|
+
export * from '../tools/markdown.js';
|
|
15
|
+
export * from '../tools/symbols.js';
|
|
16
|
+
export * from '../tools/types.js';
|
|
17
|
+
export * from '../providers/types.js';
|
|
18
|
+
export * from '../providers/factory.js';
|
|
19
|
+
export * from '../providers/validator.js';
|
|
20
|
+
export * from '../security/permissions.js';
|
|
21
|
+
export * from '../security/guardrails.js';
|
|
22
|
+
export * from '../companion/types.js';
|
|
23
|
+
export * from '../companion/petdex_bridge.js';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type MissionStage = 'understand' | 'plan' | 'build' | 'verify' | 'completed' | 'failed' | 'paused';
|
|
2
|
+
export interface MissionTask {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
status: 'pending' | 'in_progress' | 'completed' | 'failed' | 'skipped';
|
|
6
|
+
toolCall?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MissionCheckpoint {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
stage: MissionStage;
|
|
14
|
+
}
|
|
15
|
+
export interface MissionVerificationEvidence {
|
|
16
|
+
type: 'tests' | 'typecheck' | 'lint' | 'diff' | 'syntax';
|
|
17
|
+
passed: boolean;
|
|
18
|
+
details: string;
|
|
19
|
+
timestamp: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Mission {
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
objective: string;
|
|
25
|
+
stage: MissionStage;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
cwd: string;
|
|
29
|
+
model: string;
|
|
30
|
+
tasks: MissionTask[];
|
|
31
|
+
checkpoints: MissionCheckpoint[];
|
|
32
|
+
modifiedFiles: string[];
|
|
33
|
+
verificationEvidence: MissionVerificationEvidence[];
|
|
34
|
+
status: 'active' | 'paused' | 'completed' | 'cancelled';
|
|
35
|
+
}
|
|
36
|
+
export declare class MissionManager {
|
|
37
|
+
private cwd;
|
|
38
|
+
private missionsDir;
|
|
39
|
+
constructor(cwd?: string);
|
|
40
|
+
private ensureDir;
|
|
41
|
+
createMission(objective: string, model: string, title?: string): Promise<Mission>;
|
|
42
|
+
saveMission(mission: Mission): Promise<void>;
|
|
43
|
+
getMission(id: string): Promise<Mission | undefined>;
|
|
44
|
+
listMissions(): Promise<Mission[]>;
|
|
45
|
+
getActiveMission(): Promise<Mission | undefined>;
|
|
46
|
+
updateStage(id: string, stage: MissionStage): Promise<Mission | undefined>;
|
|
47
|
+
addTask(id: string, title: string, toolCall?: string): Promise<MissionTask | undefined>;
|
|
48
|
+
updateTaskStatus(missionId: string, taskId: string, status: MissionTask['status'], error?: string): Promise<boolean>;
|
|
49
|
+
addCheckpoint(id: string, checkpointId: string, name: string): Promise<void>;
|
|
50
|
+
addModifiedFile(id: string, filePath: string): Promise<void>;
|
|
51
|
+
addVerificationEvidence(id: string, evidence: Omit<MissionVerificationEvidence, 'timestamp'>): Promise<void>;
|
|
52
|
+
pauseMission(id: string): Promise<boolean>;
|
|
53
|
+
resumeMission(id: string): Promise<boolean>;
|
|
54
|
+
cancelMission(id: string): Promise<boolean>;
|
|
55
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
export class MissionManager {
|
|
4
|
+
cwd;
|
|
5
|
+
missionsDir;
|
|
6
|
+
constructor(cwd = process.cwd()) {
|
|
7
|
+
this.cwd = cwd;
|
|
8
|
+
this.missionsDir = path.join(cwd, '.overarch', 'missions');
|
|
9
|
+
}
|
|
10
|
+
async ensureDir() {
|
|
11
|
+
await fs.mkdir(this.missionsDir, { recursive: true });
|
|
12
|
+
}
|
|
13
|
+
async createMission(objective, model, title) {
|
|
14
|
+
await this.ensureDir();
|
|
15
|
+
const id = `msn_${Date.now()}`;
|
|
16
|
+
const now = new Date().toISOString();
|
|
17
|
+
const mission = {
|
|
18
|
+
id,
|
|
19
|
+
title: title || objective.slice(0, 60),
|
|
20
|
+
objective,
|
|
21
|
+
stage: 'understand',
|
|
22
|
+
createdAt: now,
|
|
23
|
+
updatedAt: now,
|
|
24
|
+
cwd: this.cwd,
|
|
25
|
+
model,
|
|
26
|
+
tasks: [],
|
|
27
|
+
checkpoints: [],
|
|
28
|
+
modifiedFiles: [],
|
|
29
|
+
verificationEvidence: [],
|
|
30
|
+
status: 'active',
|
|
31
|
+
};
|
|
32
|
+
await this.saveMission(mission);
|
|
33
|
+
return mission;
|
|
34
|
+
}
|
|
35
|
+
async saveMission(mission) {
|
|
36
|
+
await this.ensureDir();
|
|
37
|
+
mission.updatedAt = new Date().toISOString();
|
|
38
|
+
const filePath = path.join(this.missionsDir, `${mission.id}.json`);
|
|
39
|
+
await fs.writeFile(filePath, JSON.stringify(mission, null, 2), 'utf8');
|
|
40
|
+
}
|
|
41
|
+
async getMission(id) {
|
|
42
|
+
try {
|
|
43
|
+
const filePath = path.join(this.missionsDir, `${id}.json`);
|
|
44
|
+
const data = await fs.readFile(filePath, 'utf8');
|
|
45
|
+
return JSON.parse(data);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async listMissions() {
|
|
52
|
+
await this.ensureDir();
|
|
53
|
+
try {
|
|
54
|
+
const files = await fs.readdir(this.missionsDir);
|
|
55
|
+
const missions = [];
|
|
56
|
+
for (const file of files) {
|
|
57
|
+
if (file.endsWith('.json')) {
|
|
58
|
+
try {
|
|
59
|
+
const data = await fs.readFile(path.join(this.missionsDir, file), 'utf8');
|
|
60
|
+
missions.push(JSON.parse(data));
|
|
61
|
+
}
|
|
62
|
+
catch { }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return missions.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async getActiveMission() {
|
|
72
|
+
const list = await this.listMissions();
|
|
73
|
+
return list.find((m) => m.status === 'active' || m.status === 'paused') || list[0];
|
|
74
|
+
}
|
|
75
|
+
async updateStage(id, stage) {
|
|
76
|
+
const mission = await this.getMission(id);
|
|
77
|
+
if (!mission)
|
|
78
|
+
return undefined;
|
|
79
|
+
mission.stage = stage;
|
|
80
|
+
if (stage === 'completed') {
|
|
81
|
+
mission.status = 'completed';
|
|
82
|
+
}
|
|
83
|
+
else if (stage === 'failed') {
|
|
84
|
+
mission.status = 'paused';
|
|
85
|
+
}
|
|
86
|
+
await this.saveMission(mission);
|
|
87
|
+
return mission;
|
|
88
|
+
}
|
|
89
|
+
async addTask(id, title, toolCall) {
|
|
90
|
+
const mission = await this.getMission(id);
|
|
91
|
+
if (!mission)
|
|
92
|
+
return undefined;
|
|
93
|
+
const task = {
|
|
94
|
+
id: `tsk_${Date.now()}_${mission.tasks.length + 1}`,
|
|
95
|
+
title,
|
|
96
|
+
status: 'pending',
|
|
97
|
+
toolCall,
|
|
98
|
+
};
|
|
99
|
+
mission.tasks.push(task);
|
|
100
|
+
await this.saveMission(mission);
|
|
101
|
+
return task;
|
|
102
|
+
}
|
|
103
|
+
async updateTaskStatus(missionId, taskId, status, error) {
|
|
104
|
+
const mission = await this.getMission(missionId);
|
|
105
|
+
if (!mission)
|
|
106
|
+
return false;
|
|
107
|
+
const task = mission.tasks.find((t) => t.id === taskId);
|
|
108
|
+
if (!task)
|
|
109
|
+
return false;
|
|
110
|
+
task.status = status;
|
|
111
|
+
if (error)
|
|
112
|
+
task.error = error;
|
|
113
|
+
await this.saveMission(mission);
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
async addCheckpoint(id, checkpointId, name) {
|
|
117
|
+
const mission = await this.getMission(id);
|
|
118
|
+
if (!mission)
|
|
119
|
+
return;
|
|
120
|
+
mission.checkpoints.push({
|
|
121
|
+
id: checkpointId,
|
|
122
|
+
name,
|
|
123
|
+
timestamp: new Date().toISOString(),
|
|
124
|
+
stage: mission.stage,
|
|
125
|
+
});
|
|
126
|
+
await this.saveMission(mission);
|
|
127
|
+
}
|
|
128
|
+
async addModifiedFile(id, filePath) {
|
|
129
|
+
const mission = await this.getMission(id);
|
|
130
|
+
if (!mission)
|
|
131
|
+
return;
|
|
132
|
+
if (!mission.modifiedFiles.includes(filePath)) {
|
|
133
|
+
mission.modifiedFiles.push(filePath);
|
|
134
|
+
await this.saveMission(mission);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async addVerificationEvidence(id, evidence) {
|
|
138
|
+
const mission = await this.getMission(id);
|
|
139
|
+
if (!mission)
|
|
140
|
+
return;
|
|
141
|
+
mission.verificationEvidence.push({
|
|
142
|
+
...evidence,
|
|
143
|
+
timestamp: new Date().toISOString(),
|
|
144
|
+
});
|
|
145
|
+
await this.saveMission(mission);
|
|
146
|
+
}
|
|
147
|
+
async pauseMission(id) {
|
|
148
|
+
const mission = await this.getMission(id);
|
|
149
|
+
if (!mission)
|
|
150
|
+
return false;
|
|
151
|
+
mission.status = 'paused';
|
|
152
|
+
mission.stage = 'paused';
|
|
153
|
+
await this.saveMission(mission);
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
async resumeMission(id) {
|
|
157
|
+
const mission = await this.getMission(id);
|
|
158
|
+
if (!mission)
|
|
159
|
+
return false;
|
|
160
|
+
mission.status = 'active';
|
|
161
|
+
mission.stage = 'build';
|
|
162
|
+
await this.saveMission(mission);
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
async cancelMission(id) {
|
|
166
|
+
const mission = await this.getMission(id);
|
|
167
|
+
if (!mission)
|
|
168
|
+
return false;
|
|
169
|
+
mission.status = 'cancelled';
|
|
170
|
+
await this.saveMission(mission);
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './core/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './core/index.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EpisodicLesson, ProjectMemory, UserMemory, RelevantMemoryContext } from './types.js';
|
|
2
|
+
export declare class MemoryManager {
|
|
3
|
+
private projectMemoryDir;
|
|
4
|
+
private globalMemoryDir;
|
|
5
|
+
private cwd;
|
|
6
|
+
constructor(cwd?: string);
|
|
7
|
+
private ensureDirs;
|
|
8
|
+
getProjectMemory(): Promise<ProjectMemory>;
|
|
9
|
+
saveProjectMemory(memory: ProjectMemory): Promise<void>;
|
|
10
|
+
getUserMemory(): Promise<UserMemory>;
|
|
11
|
+
saveUserMemory(memory: UserMemory): Promise<void>;
|
|
12
|
+
getLessons(scope?: 'all' | 'project' | 'global'): Promise<EpisodicLesson[]>;
|
|
13
|
+
recordLesson(lesson: Omit<EpisodicLesson, 'id' | 'timestamp'>): Promise<EpisodicLesson>;
|
|
14
|
+
learnQuick(lessonText: string, tags?: string[]): Promise<EpisodicLesson>;
|
|
15
|
+
search(query: string): Promise<{
|
|
16
|
+
lessons: EpisodicLesson[];
|
|
17
|
+
conventions: string[];
|
|
18
|
+
decisions: any[];
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Selectively retrieves relevant memory for the active task.
|
|
22
|
+
* Keeps token count bounded so full memory is never dumped blindly into prompts.
|
|
23
|
+
*/
|
|
24
|
+
retrieveRelevantContext(taskPrompt: string, maxItems?: number): Promise<RelevantMemoryContext>;
|
|
25
|
+
forget(id: string): Promise<boolean>;
|
|
26
|
+
}
|