@mstar-harness/opencode 2.0.0 → 2.0.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/CHANGELOG.md CHANGED
@@ -6,6 +6,26 @@ The monorepo root [CHANGELOG.md](../../CHANGELOG.md) summarizes cross-surface re
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.0.2] - 2026-08-08
10
+
11
+ ### Fixed
12
+
13
+ - OpenCode plugin entry now default-exports `{ server: MorningStarHarnessPlugin }` so helper function exports are not registered as plugins (fixes `plugin config hook failed: N.config` / `N.dispose` on startup).
14
+
15
+ - Version alignment with harness **2.0.2** (no OpenCode package API change).
16
+
17
+ See root [CHANGELOG.md](../../CHANGELOG.md) **2.0.2**.
18
+
19
+ ## [2.0.1] - 2026-08-08
20
+
21
+ ### Fixed
22
+
23
+ - OpenCode plugin hooks no longer abort-log on non-string `task`/`write` args: Assignment and `status.json` validators refuse non-string input before `.match` / `path.resolve`, and the `tool.execute.before` hook snapshots `prompt`/`filePath` once (avoids getter/Proxy type flips).
24
+
25
+ - Version alignment with harness **2.0.1** (no OpenCode package API change).
26
+
27
+ See root [CHANGELOG.md](../../CHANGELOG.md) **2.0.1**.
28
+
9
29
  ## [2.0.0] - 2026-08-08
10
30
 
11
31
  ### Bundled harness skills (`harness-skills/` at publish)
package/dist/mstar.js CHANGED
@@ -605,6 +605,8 @@ var STATUS_FILE = "status.json";
605
605
  function validateStatusWrite(targetPath, opts = {}) {
606
606
  const log = opts.log ?? defaultStatusLogger;
607
607
  try {
608
+ if (typeof targetPath !== "string" || targetPath.trim() === "")
609
+ return null;
608
610
  const resolved = path.resolve(targetPath);
609
611
  if (path.basename(resolved) !== STATUS_FILE)
610
612
  return null;
@@ -634,13 +636,16 @@ function validateStatusWrite(targetPath, opts = {}) {
634
636
  var ASSIGNMENT_HEADING_RE = /^#{1,6}\s+Assignment\s*$/m;
635
637
  var ASSIGNMENT_FIELD_RE = /^[ \t]*(?:[-*][ \t]+)?\*{0,2}(Execute as|Delegation|Task category)\*{0,2}[ \t]*:[ \t]*(\S.*)$/gm;
636
638
  function isAssignmentShaped(assignmentText) {
639
+ if (typeof assignmentText !== "string")
640
+ return false;
637
641
  return ASSIGNMENT_HEADING_RE.test(assignmentText) || assignmentText.match(ASSIGNMENT_FIELD_RE) !== null;
638
642
  }
639
643
  function validateDispatchAssignment(assignmentText, opts = {}) {
640
644
  const log = opts.log ?? defaultStatusLogger;
641
645
  try {
642
- if (!isAssignmentShaped(assignmentText))
646
+ if (typeof assignmentText !== "string" || !isAssignmentShaped(assignmentText)) {
643
647
  return { ok: true, violations: [] };
648
+ }
644
649
  const violations = [];
645
650
  const fields = parseAssignmentFields(assignmentText);
646
651
  const writable = isReadOnlyAssignmentRole(fields.executeAs ?? "") ? false : undefined;
@@ -711,15 +716,19 @@ var MorningStarHarnessPlugin = async () => {
711
716
  },
712
717
  "tool.execute.before": async (input, output) => {
713
718
  const args = output?.args ?? {};
714
- if (input.tool === "task" && typeof args.prompt === "string") {
719
+ const prompt = args.prompt;
720
+ const rawFilePath = args.filePath;
721
+ const rawPath = args.path;
722
+ const filePath = typeof rawFilePath === "string" ? rawFilePath : typeof rawPath === "string" ? rawPath : undefined;
723
+ if (input.tool === "task" && typeof prompt === "string") {
715
724
  const subagentType = typeof args.subagent === "string" ? args.subagent : typeof args.subagent_type === "string" ? args.subagent_type : "";
716
- const gate = validateDispatchAssignment(args.prompt, { subagentType });
725
+ const gate = validateDispatchAssignment(prompt, { subagentType });
717
726
  if (gate?.hardBlocked) {
718
727
  defaultStatusLogger("error", "hard-gate blocked (hardBlocked=true) — refusal requires a host refusal channel");
719
728
  }
720
729
  return;
721
730
  }
722
- if (typeof args.filePath !== "string")
731
+ if (typeof filePath !== "string")
723
732
  return;
724
733
  if (input.tool === "write") {
725
734
  const rawContent = args.content;
@@ -730,13 +739,15 @@ var MorningStarHarnessPlugin = async () => {
730
739
  } catch {
731
740
  doc = undefined;
732
741
  }
742
+ } else if (rawContent !== null && typeof rawContent === "object") {
743
+ doc = rawContent;
733
744
  }
734
- const gate = validateStatusWrite(args.filePath, { doc });
745
+ const gate = validateStatusWrite(filePath, { doc });
735
746
  if (gate?.hardBlocked) {
736
747
  defaultStatusLogger("error", "hard-gate blocked (hardBlocked=true) — refusal requires a host refusal channel");
737
748
  }
738
749
  } else if (input.tool === "edit") {
739
- const gate = validateStatusWrite(args.filePath);
750
+ const gate = validateStatusWrite(filePath);
740
751
  if (gate?.hardBlocked) {
741
752
  defaultStatusLogger("error", "hard-gate blocked (hardBlocked=true) — refusal requires a host refusal channel");
742
753
  }
@@ -761,8 +772,12 @@ var MorningStarHarnessPlugin = async () => {
761
772
  }
762
773
  };
763
774
  };
775
+ var mstar_default = {
776
+ server: MorningStarHarnessPlugin
777
+ };
764
778
  export {
765
779
  validateStatusWrite,
766
780
  validateDispatchAssignment,
781
+ mstar_default as default,
767
782
  MorningStarHarnessPlugin
768
783
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstar-harness/opencode",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Morning Star harness OpenCode plugin — skills bootstrap + engine-backed runtime hooks (status lint, dispatch validation, Enforcement: hard gates).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,6 +36,6 @@
36
36
  "access": "public"
37
37
  },
38
38
  "devDependencies": {
39
- "@mstar-harness/engine": "2.0.0"
39
+ "@mstar-harness/engine": "2.0.2"
40
40
  }
41
41
  }