@prevalentware/opencode-goal-plugin 0.1.39 → 0.1.41

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/server.js +33 -6
  2. package/package.json +5 -5
package/dist/server.js CHANGED
@@ -1875,6 +1875,21 @@ function v2ObjectSchema(properties, required = []) {
1875
1875
  additionalProperties: false
1876
1876
  };
1877
1877
  }
1878
+ function decodeV2Event(value) {
1879
+ let decoded = value;
1880
+ if (typeof decoded === "string") {
1881
+ try {
1882
+ decoded = JSON.parse(decoded);
1883
+ } catch {
1884
+ return;
1885
+ }
1886
+ }
1887
+ if (!isRecord(decoded) || typeof decoded.type !== "string" || !isRecord(decoded.data))
1888
+ return;
1889
+ if (typeof decoded.created !== "number")
1890
+ return;
1891
+ return decoded;
1892
+ }
1878
1893
  function textFromToolResult(result) {
1879
1894
  if (typeof result.output === "string")
1880
1895
  return result.output;
@@ -2963,11 +2978,21 @@ async function setupV2(context) {
2963
2978
  }
2964
2979
  if (registerCommand) {
2965
2980
  registrations.push(await context.command.transform((draft) => {
2966
- if (draft.get(commandName))
2967
- return;
2968
- draft.update(commandName, (command) => {
2969
- command.description = "Set or view the long-running session goal";
2970
- command.template = goalCommandTemplate(commandName);
2981
+ draft.add({
2982
+ name: commandName,
2983
+ description: "Set or view the long-running session goal",
2984
+ execute: async (input) => {
2985
+ const stripMention = ({ mention: _mention, ...attachment }) => attachment;
2986
+ await context.session.prompt({
2987
+ ...input.prompt,
2988
+ files: input.prompt.files?.map(stripMention),
2989
+ agents: input.prompt.agents?.map(stripMention),
2990
+ skills: input.prompt.skills?.map(stripMention),
2991
+ sessionID: input.sessionID,
2992
+ text: goalCommandTemplate(commandName).replaceAll("$ARGUMENTS", () => input.prompt.text.trim()),
2993
+ delivery: input.delivery
2994
+ });
2995
+ }
2971
2996
  });
2972
2997
  }));
2973
2998
  }
@@ -3031,7 +3056,9 @@ async function setupV2(context) {
3031
3056
  const { done, value } = await iterator.next();
3032
3057
  if (done)
3033
3058
  break;
3034
- await handleV2Event(value);
3059
+ const event = decodeV2Event(value);
3060
+ if (event)
3061
+ await handleV2Event(event);
3035
3062
  }
3036
3063
  } catch (error) {
3037
3064
  if (!abortController.signal.aborted)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prevalentware/opencode-goal-plugin",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "description": "OpenCode goal plugin that adds Codex-style long-running goal mode, /goal commands, persistence, and TUI status for AI coding agents.",
5
5
  "keywords": [
6
6
  "opencode",
@@ -55,16 +55,16 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@opencode-ai/plugin": "^1.17.1",
58
- "@opentui/solid": "^0.4.0",
58
+ "@opentui/solid": ">=0.4.0 <0.6.0",
59
59
  "effect": "^3.21.2",
60
60
  "solid-js": "1.9.12",
61
61
  "zod": "^4.1.8"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@eslint/js": "^10.0.1",
65
- "@opencode-ai/plugin-v2": "npm:@opencode-ai/plugin@0.0.0-next-17055",
66
- "@opencode-ai/theme": "0.0.0-next-17055",
67
- "@opentui/core": "^0.4.0",
65
+ "@opencode-ai/plugin-v2": "npm:@opencode-ai/plugin@0.0.0-beta-18593",
66
+ "@opencode-ai/theme": "0.0.0-beta-18593",
67
+ "@opentui/core": "0.5.9",
68
68
  "@types/bun": "^1.3.13",
69
69
  "eslint": "^10.3.0",
70
70
  "typescript": "^6.0.3",