@signetai/connector-opencode 0.214.31 → 0.214.33

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.
Files changed (2) hide show
  1. package/dist/index.js +87 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -37519,20 +37519,84 @@ var IDENTITY_FILES2 = {
37519
37519
  session: "dreaming"
37520
37520
  }
37521
37521
  };
37522
+ var IDENTITY_PRESETS = {
37523
+ minimal: {
37524
+ name: "minimal",
37525
+ description: "AGENTS.md only for normal startup, plus DREAMING.md for dreaming sessions.",
37526
+ startup: [{ path: "AGENTS.md", role: "operating_instructions", budget: 12000 }],
37527
+ special: [{ path: "DREAMING.md", kind: "dreaming", role: "dreaming_prompt", budget: 4000 }]
37528
+ },
37529
+ hermes: {
37530
+ name: "hermes",
37531
+ description: "Hermes-style SOUL.md primary identity with project-context discovery handled by Hermes.",
37532
+ startup: [
37533
+ { path: "SOUL.md", role: "primary_identity", budget: 4000 },
37534
+ { path: "AGENTS.md", role: "project_context", budget: 12000 }
37535
+ ],
37536
+ special: [{ path: "DREAMING.md", kind: "dreaming", role: "dreaming_prompt", budget: 4000 }]
37537
+ },
37538
+ openclaw: {
37539
+ name: "openclaw",
37540
+ description: "OpenClaw-style rich identity stack for character-forward agents.",
37541
+ startup: [
37542
+ { path: "AGENTS.md", role: "operating_instructions", budget: 12000 },
37543
+ { path: "SOUL.md", role: "persona", budget: 4000 },
37544
+ { path: "IDENTITY.md", role: "agent_identity", budget: 2000 },
37545
+ { path: "USER.md", role: "user_profile", budget: 6000 },
37546
+ { path: "MEMORY.md", role: "working_memory", budget: 1e4 }
37547
+ ],
37548
+ special: [
37549
+ { path: "HEARTBEAT.md", kind: "heartbeat", role: "heartbeat_prompt", budget: 4000 },
37550
+ { path: "DREAMING.md", kind: "dreaming", role: "dreaming_prompt", budget: 4000 },
37551
+ { path: "BOOTSTRAP.md", kind: "bootstrap", role: "bootstrap_prompt", budget: 4000 }
37552
+ ]
37553
+ },
37554
+ custom: {
37555
+ name: "custom",
37556
+ description: "User-selected startup files and explicit order.",
37557
+ startup: [{ path: "AGENTS.md", role: "operating_instructions", budget: 12000 }],
37558
+ special: [{ path: "DREAMING.md", kind: "dreaming", role: "dreaming_prompt", budget: 4000 }]
37559
+ }
37560
+ };
37522
37561
  var REQUIRED_IDENTITY_KEYS2 = Object.entries(IDENTITY_FILES2).filter(([, spec]) => !spec.optional).map(([key]) => key);
37523
37562
  var OPTIONAL_IDENTITY_KEYS2 = Object.entries(IDENTITY_FILES2).filter(([, spec]) => spec.optional).map(([key]) => key);
37524
37563
  function hasValidIdentity(basePath) {
37525
37564
  const mode = loadIdentityMode(basePath);
37526
37565
  if (mode !== "managed")
37527
37566
  return true;
37528
- for (const key of REQUIRED_IDENTITY_KEYS2) {
37529
- const spec = IDENTITY_FILES2[key];
37530
- if (!existsSync12(join13(basePath, spec.path))) {
37567
+ for (const path of resolveRequiredIdentityPaths(basePath)) {
37568
+ if (!existsSync12(join13(basePath, path))) {
37531
37569
  return false;
37532
37570
  }
37533
37571
  }
37534
37572
  return true;
37535
37573
  }
37574
+ function resolveRequiredIdentityPaths(basePath) {
37575
+ const legacyRequired = () => REQUIRED_IDENTITY_KEYS2.map((key) => IDENTITY_FILES2[key].path);
37576
+ const agentYaml = join13(basePath, "agent.yaml");
37577
+ if (!existsSync12(agentYaml))
37578
+ return legacyRequired();
37579
+ try {
37580
+ const config = parseSimpleYaml(readFileSync10(agentYaml, "utf-8"));
37581
+ const identity = readRecord(readRecord(config).identity);
37582
+ const configured = readIdentityEntryList(readRecord(identity.startup).load);
37583
+ if (configured.length > 0)
37584
+ return [...new Set(configured.map((entry) => entry.path))];
37585
+ const presetName = typeof identity.preset === "string" ? identity.preset : "";
37586
+ const preset = IDENTITY_PRESETS[presetName];
37587
+ if (preset)
37588
+ return [...new Set(preset.startup.map((entry) => entry.path))];
37589
+ } catch {}
37590
+ return legacyRequired();
37591
+ }
37592
+ function isSafeRelativeIdentityPath(path) {
37593
+ const trimmed = path.trim();
37594
+ if (!trimmed)
37595
+ return false;
37596
+ if (trimmed.startsWith("/") || trimmed.startsWith("~"))
37597
+ return false;
37598
+ return !trimmed.split(/[\\/]/).includes("..");
37599
+ }
37536
37600
  function readRecord(value) {
37537
37601
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
37538
37602
  }
@@ -37565,6 +37629,26 @@ function loadIdentityMode(agentsDir) {
37565
37629
  return "managed";
37566
37630
  }
37567
37631
  }
37632
+ function readIdentityEntry(value) {
37633
+ if (typeof value === "string") {
37634
+ return isSafeRelativeIdentityPath(value) ? { path: value } : null;
37635
+ }
37636
+ const record = readRecord(value);
37637
+ const path = typeof record.path === "string" ? record.path.trim() : "";
37638
+ if (!isSafeRelativeIdentityPath(path))
37639
+ return null;
37640
+ if (record.enabled === false)
37641
+ return null;
37642
+ const role = typeof record.role === "string" ? record.role : undefined;
37643
+ const rawBudget = typeof record.budget === "number" ? record.budget : Number.parseInt(String(record.budget ?? ""), 10);
37644
+ const budget = Number.isFinite(rawBudget) && rawBudget > 0 ? Math.floor(rawBudget) : undefined;
37645
+ return { path, role, budget };
37646
+ }
37647
+ function readIdentityEntryList(value) {
37648
+ if (!Array.isArray(value))
37649
+ return [];
37650
+ return value.map(readIdentityEntry).filter((entry) => entry !== null);
37651
+ }
37568
37652
  var home2 = homedir102();
37569
37653
 
37570
37654
  // ../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/connector-opencode",
3
- "version": "0.214.31",
3
+ "version": "0.214.33",
4
4
  "description": "Signet connector for OpenCode - installs hooks and generates config",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,8 +25,8 @@
25
25
  "typecheck": "tsc --noEmit"
26
26
  },
27
27
  "dependencies": {
28
- "@signetai/connector-base": "0.214.31",
29
- "@signetai/core": "0.214.31",
28
+ "@signetai/connector-base": "0.214.33",
29
+ "@signetai/core": "0.214.33",
30
30
  "jsonc-parser": "3.3.1"
31
31
  },
32
32
  "devDependencies": {