@opencoreai/opencore 0.4.1 → 0.4.2
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 +1 -1
- package/scripts/postinstall.mjs +27 -3
- package/src/dashboard-server.ts +1 -1
- package/src/index.ts +25 -1
- package/src/opencore-indicator.m +4 -4
- package/src/skill-catalog.mjs +2 -2
- package/templates/default-guidelines.md +3 -1
- package/templates/default-instructions.md +3 -2
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -16,6 +16,9 @@ const __dirname = path.dirname(__filename);
|
|
|
16
16
|
const ROOT_DIR = path.resolve(__dirname, "..");
|
|
17
17
|
const TEMPLATE_DIR = path.join(ROOT_DIR, "templates");
|
|
18
18
|
const OPENCORE_HOME = path.join(os.homedir(), ".opencore");
|
|
19
|
+
const AGENTS_DIR = path.join(OPENCORE_HOME, ".agents");
|
|
20
|
+
const SKILLS_DIR = path.join(AGENTS_DIR, "skills");
|
|
21
|
+
const LEGACY_SKILLS_DIR = path.join(OPENCORE_HOME, "skills");
|
|
19
22
|
const SETTINGS_PATH = path.join(OPENCORE_HOME, "configs", "settings.json");
|
|
20
23
|
const GUIDELINES_PATH = path.join(OPENCORE_HOME, "guidelines.md");
|
|
21
24
|
const INSTRUCTIONS_PATH = path.join(OPENCORE_HOME, "instructions.md");
|
|
@@ -26,10 +29,11 @@ const PROFILE_SECTION_START = "<!-- OPENCORE_INSTALL_PROFILE_START -->";
|
|
|
26
29
|
const PROFILE_SECTION_END = "<!-- OPENCORE_INSTALL_PROFILE_END -->";
|
|
27
30
|
const DIRECTORIES = [
|
|
28
31
|
OPENCORE_HOME,
|
|
32
|
+
AGENTS_DIR,
|
|
29
33
|
path.join(OPENCORE_HOME, "configs"),
|
|
30
34
|
path.join(OPENCORE_HOME, "logs"),
|
|
31
35
|
path.join(OPENCORE_HOME, "cache"),
|
|
32
|
-
|
|
36
|
+
SKILLS_DIR,
|
|
33
37
|
];
|
|
34
38
|
const execFileAsync = promisify(execFile);
|
|
35
39
|
|
|
@@ -213,13 +217,13 @@ async function configureTelegram(currentSettings) {
|
|
|
213
217
|
}
|
|
214
218
|
|
|
215
219
|
async function installSelectedSkills(skillIds) {
|
|
216
|
-
await ensureDir(
|
|
220
|
+
await ensureDir(SKILLS_DIR);
|
|
217
221
|
const installed = [];
|
|
218
222
|
const skipped = [];
|
|
219
223
|
for (const id of skillIds) {
|
|
220
224
|
const skill = SKILL_CATALOG.find((item) => item.id === id);
|
|
221
225
|
if (!skill) continue;
|
|
222
|
-
const dir = path.join(
|
|
226
|
+
const dir = path.join(SKILLS_DIR, skill.id);
|
|
223
227
|
const skillFile = path.join(dir, "SKILL.md");
|
|
224
228
|
const configFile = path.join(dir, "config.json");
|
|
225
229
|
try {
|
|
@@ -248,6 +252,25 @@ async function installSelectedSkills(skillIds) {
|
|
|
248
252
|
return { installed, skipped };
|
|
249
253
|
}
|
|
250
254
|
|
|
255
|
+
async function migrateLegacySkillsDir() {
|
|
256
|
+
try {
|
|
257
|
+
const entries = await fs.readdir(LEGACY_SKILLS_DIR, { withFileTypes: true });
|
|
258
|
+
await ensureDir(SKILLS_DIR);
|
|
259
|
+
for (const entry of entries) {
|
|
260
|
+
if (!entry.isDirectory()) continue;
|
|
261
|
+
const fromDir = path.join(LEGACY_SKILLS_DIR, entry.name);
|
|
262
|
+
const toDir = path.join(SKILLS_DIR, entry.name);
|
|
263
|
+
try {
|
|
264
|
+
await fs.access(toDir);
|
|
265
|
+
continue;
|
|
266
|
+
} catch {}
|
|
267
|
+
await fs.rename(fromDir, toDir).catch(async () => {
|
|
268
|
+
await fs.cp(fromDir, toDir, { recursive: true, force: false });
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
} catch {}
|
|
272
|
+
}
|
|
273
|
+
|
|
251
274
|
async function promptSkillInstallation() {
|
|
252
275
|
if (!(input.isTTY && output.isTTY)) return;
|
|
253
276
|
const choices = [
|
|
@@ -407,6 +430,7 @@ async function run() {
|
|
|
407
430
|
await ensureTemplateApplied(GUIDELINES_PATH, defaultGuidelines, ["# OpenCore Guidelines\n"]);
|
|
408
431
|
await ensureTemplateApplied(INSTRUCTIONS_PATH, defaultInstructions, ["# OpenCore Instructions\n"]);
|
|
409
432
|
await ensureFile(SETTINGS_PATH, `${JSON.stringify(DEFAULT_CONFIG, null, 2)}\n`);
|
|
433
|
+
await migrateLegacySkillsDir();
|
|
410
434
|
await ensureCredentialStore();
|
|
411
435
|
await ensureDefaultSkillsInstalled();
|
|
412
436
|
|
package/src/dashboard-server.ts
CHANGED
|
@@ -61,7 +61,7 @@ export class DashboardServer {
|
|
|
61
61
|
this.options = options;
|
|
62
62
|
this.app.disable("x-powered-by");
|
|
63
63
|
this.dashboardDir = path.join(options.rootDir, "opencore dashboard");
|
|
64
|
-
this.skillsDir = path.join(options.openCoreHome, "skills");
|
|
64
|
+
this.skillsDir = path.join(options.openCoreHome, ".agents", "skills");
|
|
65
65
|
this.schedulesPath = path.join(options.openCoreHome, "configs", "schedules.json");
|
|
66
66
|
this.chatLogPath = path.join(options.openCoreHome, "chat-history.json");
|
|
67
67
|
this.vendorMap = {
|
package/src/index.ts
CHANGED
|
@@ -43,7 +43,9 @@ const INSTRUCTIONS_PATH = path.join(OPENCORE_HOME, "instructions.md");
|
|
|
43
43
|
const SETTINGS_PATH = path.join(OPENCORE_HOME, "configs", "settings.json");
|
|
44
44
|
const SCHEDULES_PATH = path.join(OPENCORE_HOME, "configs", "schedules.json");
|
|
45
45
|
const SCREENSHOT_DIR = path.join(OPENCORE_HOME, "screenshots");
|
|
46
|
-
const
|
|
46
|
+
const AGENTS_DIR = path.join(OPENCORE_HOME, ".agents");
|
|
47
|
+
const SKILLS_DIR = path.join(AGENTS_DIR, "skills");
|
|
48
|
+
const LEGACY_SKILLS_DIR = path.join(OPENCORE_HOME, "skills");
|
|
47
49
|
const INDICATOR_STATE_PATH = path.join(OPENCORE_HOME, "indicator-state.json");
|
|
48
50
|
const SCHEDULER_LOG_PATH = path.join(OPENCORE_HOME, "logs", "scheduler.log");
|
|
49
51
|
const DASHBOARD_PORT = Number(process.env.OPENCORE_DASHBOARD_PORT || 4111);
|
|
@@ -200,6 +202,7 @@ async function chmodIfPossible(targetPath: string, mode: number) {
|
|
|
200
202
|
async function enforceOpenCorePermissions() {
|
|
201
203
|
const dirs = [
|
|
202
204
|
OPENCORE_HOME,
|
|
205
|
+
AGENTS_DIR,
|
|
203
206
|
path.join(OPENCORE_HOME, "configs"),
|
|
204
207
|
path.join(OPENCORE_HOME, "logs"),
|
|
205
208
|
path.join(OPENCORE_HOME, "cache"),
|
|
@@ -344,6 +347,7 @@ async function ensureOpenCoreHome() {
|
|
|
344
347
|
await fs.mkdir(path.join(OPENCORE_HOME, "configs"), { recursive: true });
|
|
345
348
|
await fs.mkdir(path.join(OPENCORE_HOME, "logs"), { recursive: true });
|
|
346
349
|
await fs.mkdir(path.join(OPENCORE_HOME, "cache"), { recursive: true });
|
|
350
|
+
await fs.mkdir(AGENTS_DIR, { recursive: true });
|
|
347
351
|
await fs.mkdir(SCREENSHOT_DIR, { recursive: true });
|
|
348
352
|
await fs.mkdir(SKILLS_DIR, { recursive: true });
|
|
349
353
|
|
|
@@ -394,10 +398,30 @@ async function ensureOpenCoreHome() {
|
|
|
394
398
|
await fs.writeFile(SCHEDULES_PATH, "[]\n", "utf8");
|
|
395
399
|
}
|
|
396
400
|
await ensureDefaultOpenCoreSkills();
|
|
401
|
+
await migrateLegacySkillsDir();
|
|
397
402
|
await ensureCredentialStore();
|
|
398
403
|
await enforceOpenCorePermissions();
|
|
399
404
|
}
|
|
400
405
|
|
|
406
|
+
async function migrateLegacySkillsDir() {
|
|
407
|
+
try {
|
|
408
|
+
const entries = await fs.readdir(LEGACY_SKILLS_DIR, { withFileTypes: true });
|
|
409
|
+
await fs.mkdir(SKILLS_DIR, { recursive: true });
|
|
410
|
+
for (const entry of entries) {
|
|
411
|
+
if (!entry.isDirectory()) continue;
|
|
412
|
+
const fromDir = path.join(LEGACY_SKILLS_DIR, entry.name);
|
|
413
|
+
const toDir = path.join(SKILLS_DIR, entry.name);
|
|
414
|
+
try {
|
|
415
|
+
await fs.access(toDir);
|
|
416
|
+
continue;
|
|
417
|
+
} catch {}
|
|
418
|
+
await fs.rename(fromDir, toDir).catch(async () => {
|
|
419
|
+
await fs.cp(fromDir, toDir, { recursive: true, force: false });
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
} catch {}
|
|
423
|
+
}
|
|
424
|
+
|
|
401
425
|
async function ensureDefaultOpenCoreSkills() {
|
|
402
426
|
for (const skill of DEFAULT_SYSTEM_SKILLS) {
|
|
403
427
|
const dir = path.join(SKILLS_DIR, skill.id);
|
package/src/opencore-indicator.m
CHANGED
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
|
|
126
126
|
if (self.statusGlowLayer == nil) {
|
|
127
127
|
self.statusGlowLayer = [CALayer layer];
|
|
128
|
-
self.statusGlowLayer.cornerRadius =
|
|
128
|
+
self.statusGlowLayer.cornerRadius = 10.0;
|
|
129
129
|
self.statusGlowLayer.shadowOpacity = 0.34f;
|
|
130
130
|
self.statusGlowLayer.shadowRadius = 10.0f;
|
|
131
131
|
self.statusGlowLayer.shadowOffset = CGSizeMake(0, 0);
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
|
|
136
136
|
if (self.statusPillLayer == nil) {
|
|
137
137
|
self.statusPillLayer = [CAGradientLayer layer];
|
|
138
|
-
self.statusPillLayer.cornerRadius =
|
|
138
|
+
self.statusPillLayer.cornerRadius = 10.0;
|
|
139
139
|
self.statusPillLayer.borderWidth = 1.0;
|
|
140
140
|
self.statusPillLayer.startPoint = CGPointMake(0.0, 0.5);
|
|
141
141
|
self.statusPillLayer.endPoint = CGPointMake(1.0, 0.5);
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
};
|
|
211
211
|
CGFloat textWidth = ceil([title sizeWithAttributes:attributes].width);
|
|
212
212
|
CGFloat iconWidth = button.image != nil ? 18.0 : 0.0;
|
|
213
|
-
CGFloat totalWidth = textWidth + iconWidth +
|
|
213
|
+
CGFloat totalWidth = textWidth + iconWidth + 24.0;
|
|
214
214
|
CGFloat width = MAX(122.0, totalWidth);
|
|
215
215
|
CGFloat height = 24.0;
|
|
216
216
|
CGFloat x = floor((NSWidth(button.bounds) - width) / 2.0);
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
self.statusPillLayer.borderColor = [[self.orangeBadgeBorderColor colorWithAlphaComponent:(active ? (self.hoverActive ? 1.0 : 0.85) : (self.hoverActive ? 0.86 : 0.60))] CGColor];
|
|
232
232
|
|
|
233
233
|
self.statusShineLayer.frame = CGRectMake(8.0, 2.0, width - 16.0, height * 0.48);
|
|
234
|
-
self.statusShineLayer.cornerRadius =
|
|
234
|
+
self.statusShineLayer.cornerRadius = 8.0;
|
|
235
235
|
self.statusShineLayer.opacity = active ? (self.hoverActive ? 1.0f : 0.95f) : (self.hoverActive ? 0.84f : 0.62f);
|
|
236
236
|
}
|
|
237
237
|
|
package/src/skill-catalog.mjs
CHANGED
|
@@ -17,7 +17,7 @@ description: Create or update OpenCore skills with focused triggers, reusable in
|
|
|
17
17
|
# Skill Creator
|
|
18
18
|
|
|
19
19
|
## Purpose
|
|
20
|
-
Create, repair, or improve reusable OpenCore skills under ~/.opencore/skills.
|
|
20
|
+
Create, repair, or improve reusable OpenCore skills under ~/.opencore/.agents/skills.
|
|
21
21
|
|
|
22
22
|
## Use This Skill When
|
|
23
23
|
- User asks for a new OpenCore skill.
|
|
@@ -26,7 +26,7 @@ Create, repair, or improve reusable OpenCore skills under ~/.opencore/skills.
|
|
|
26
26
|
|
|
27
27
|
## Workflow
|
|
28
28
|
1. Define the skill purpose, trigger phrases, and expected outcome.
|
|
29
|
-
2. Create or update ~/.opencore/skills/<skill-id>/SKILL.md with concise operating instructions.
|
|
29
|
+
2. Create or update ~/.opencore/.agents/skills/<skill-id>/SKILL.md with concise operating instructions.
|
|
30
30
|
3. Create or update config.json with id, name, description, version, category, and triggers.
|
|
31
31
|
4. Keep the skill narrow enough to be reliable, but complete enough to be reusable.
|
|
32
32
|
5. Summarize how the skill should be triggered and what it changes.
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
- Computer Agent must not make independent policy decisions outside delegated scope.
|
|
16
16
|
|
|
17
17
|
## Skills Rules
|
|
18
|
-
- OpenCore
|
|
18
|
+
- OpenCore agent assets are stored under `~/.opencore/.agents`.
|
|
19
|
+
- OpenCore skills are stored under `~/.opencore/.agents/skills`.
|
|
19
20
|
- `skill-creator` is a built-in OpenCore skill and should exist by default.
|
|
20
21
|
- `continuous-operations` is a built-in OpenCore skill and should exist by default.
|
|
21
22
|
- `builder` is a built-in OpenCore skill and should exist by default.
|
|
22
23
|
- `credential-operator` is a built-in OpenCore skill and should exist by default.
|
|
23
24
|
- Manager Agent must check installed skills before planning and execution.
|
|
25
|
+
- Dashboard must also read installed skills from `~/.opencore/.agents/skills`.
|
|
24
26
|
- If a relevant skill exists, Manager Agent should follow it.
|
|
25
27
|
- If no relevant skill exists, proceed with default behavior.
|
|
26
28
|
- Skills do not override core safety rules in this file.
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
05. Computer Agent is only for macOS UI control tasks.
|
|
9
9
|
06. If no UI control is needed, Manager should answer directly.
|
|
10
10
|
07. If user asks to edit soul/memory/guidelines/instructions, Manager should edit locally.
|
|
11
|
-
07.1 Manager should also handle heartbeat.md and skills content under ~/.opencore/skills.
|
|
11
|
+
07.1 Manager should also handle heartbeat.md and skills content under ~/.opencore/.agents/skills.
|
|
12
12
|
08. Manager should delegate to Computer Agent only when interaction with apps/windows is required.
|
|
13
13
|
08.1 For future-time or recurring requests, Manager should prefer cron-backed scheduling when possible.
|
|
14
14
|
09. Manager should keep responses concise and operational.
|
|
15
15
|
10. Manager should follow soul.md, guidelines.md, instructions.md, memory.md, and config context.
|
|
16
16
|
10.05 Manager should also use computer-profile.md for durable machine facts such as installed apps, default browser, workspace, hardware profile, and permission-related environment facts.
|
|
17
|
-
10.1 Manager should inspect and follow installed OpenCore skills in ~/.opencore/skills when relevant.
|
|
17
|
+
10.1 Manager should inspect and follow installed OpenCore skills in ~/.opencore/.agents/skills when relevant.
|
|
18
|
+
10.15 Dashboard should read and display installed skills from ~/.opencore/.agents/skills.
|
|
18
19
|
10.2 Built-in skills for skill creation, continuous operations, and internal tool building should be treated as always available if installed.
|
|
19
20
|
10.3 The credential-operator skill should be treated as a built-in subsystem for login, sign-up, password reuse, verification handling, and saving credentials locally.
|
|
20
21
|
11. Computer Agent should follow the same policy context while executing UI actions.
|