@maestria/opencode 0.4.0 → 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/dist/index.js CHANGED
@@ -2,8 +2,8 @@ import { readFileSync, readdirSync } from "fs";
2
2
  import { join, dirname, basename } from "path";
3
3
  import { parse as parseYaml } from "yaml";
4
4
  import { fileURLToPath } from "url";
5
- import { maestriaOptionsSchema } from "./modes/types";
6
- import { detectMode, stripKeyword, getModeMarker, getModePrompt } from "./modes/index";
5
+ import { maestriaOptionsSchema } from "@/modes/types.js";
6
+ import { detectMode, stripKeyword, getModeMarker, getModePrompt } from "@/modes/index.js";
7
7
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
8
  const agentsDir = join(__dirname, "..", "agents");
9
9
  const rulesPath = join(__dirname, "..", "rules", "AGENTS.md");
@@ -84,17 +84,17 @@ export const MaestriaPlugin = async (_input, options) => {
84
84
  const result = detectMode(textPart.text, disabledKeywords);
85
85
  if (!result)
86
86
  return;
87
- // Strip keyword from text
88
- textPart.text = stripKeyword(textPart.text, result);
89
- // Inject mode marker + prompt at the front of parts
90
- hookOutput.parts.unshift({
91
- id: crypto.randomUUID(),
92
- sessionID: hookInput.sessionID,
93
- messageID: hookOutput.message.id,
94
- type: "text",
95
- text: [getModeMarker(result.mode), "", getModePrompt(result.mode)].join("\n"),
96
- synthetic: true,
97
- });
87
+ // Strip keyword from text and prepend mode marker + prompt inline.
88
+ // We embed everything in the existing text part rather than injecting
89
+ // a second text part into `parts`, because the OpenCode runtime does
90
+ // not handle multiple text parts per message (causes a hang).
91
+ textPart.text = [
92
+ getModeMarker(result.mode),
93
+ "",
94
+ getModePrompt(result.mode),
95
+ "",
96
+ stripKeyword(textPart.text, result),
97
+ ].join("\n");
98
98
  },
99
99
  };
100
100
  };
@@ -1,4 +1,4 @@
1
- import type { ModeResult } from "./types";
1
+ import type { ModeResult } from "./types.js";
2
2
  /**
3
3
  * Detect a workflow mode keyword in the given text.
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { escapeRegExp } from "es-toolkit";
2
- import { MODE_PROMPTS, MODE_MARKERS, VALID_KEYWORDS } from "./prompts";
2
+ import { MODE_PROMPTS, MODE_MARKERS, VALID_KEYWORDS } from "./prompts.js";
3
3
  /**
4
4
  * Priority mapping for mode keyword restrictiveness.
5
5
  * Higher number = more restrictive = wins when multiple keywords are present.
@@ -1,4 +1,4 @@
1
- import type { ModeKeyword } from "./types";
1
+ import type { ModeKeyword } from "./types.js";
2
2
  /**
3
3
  * Mode prompt text for each keyword.
4
4
  * These are injected into the turn when a mode is detected.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maestria/opencode",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "OpenCode plugin encoding AI engineering praxis: rules, agents, and workflow discipline.",
5
5
  "keywords": [
6
6
  "agents",
@@ -54,7 +54,7 @@
54
54
  "node": ">=22.12.0"
55
55
  },
56
56
  "scripts": {
57
- "build": "tsc",
57
+ "build": "tsc -p tsconfig.build.json && bash scripts/verify-imports.sh",
58
58
  "test": "node ./node_modules/vitest/vitest.mjs run"
59
59
  }
60
60
  }