opencode-manifold 0.4.20 → 0.4.22

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 (3) hide show
  1. package/dist/index.js +105 -1
  2. package/dist/tui.js +123 -0
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,3 +1,98 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true,
11
+ configurable: true,
12
+ set: __exportSetter.bind(all, name)
13
+ });
14
+ };
15
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
16
+
17
+ // src/tools/get-model-path.ts
18
+ var exports_get_model_path = {};
19
+ __export(exports_get_model_path, {
20
+ setPluginContext: () => setPluginContext2,
21
+ getModelPathTool: () => getModelPathTool,
22
+ getModelPath: () => getModelPath
23
+ });
24
+ import { tool as tool2 } from "@opencode-ai/plugin";
25
+ async function getModelPath(client, sessionID) {
26
+ if (sessionID) {
27
+ try {
28
+ const messagesResponse = await client.session.messages({
29
+ path: { id: sessionID }
30
+ });
31
+ if (messagesResponse.data && messagesResponse.data.length > 0) {
32
+ const lastMessage = messagesResponse.data[messagesResponse.data.length - 1];
33
+ if (lastMessage.info) {
34
+ if (lastMessage.info.role === "assistant") {
35
+ const assistantMsg = lastMessage.info;
36
+ return `${assistantMsg.providerID}/${assistantMsg.modelID}`;
37
+ }
38
+ if (lastMessage.info.model) {
39
+ const { providerID, modelID } = lastMessage.info.model;
40
+ return `${providerID}/${modelID}`;
41
+ }
42
+ }
43
+ }
44
+ } catch (error) {
45
+ await client.app.log({
46
+ body: {
47
+ service: "opencode-manifold",
48
+ level: "warn",
49
+ message: `Error getting model from session messages: ${error}`
50
+ }
51
+ });
52
+ }
53
+ }
54
+ try {
55
+ const providersResponse = await client.config.providers({});
56
+ if (providersResponse.data && providersResponse.data.default) {
57
+ const defaults = providersResponse.data.default;
58
+ const defaultModel = defaults["model"] || defaults["small_model"];
59
+ if (defaultModel && typeof defaultModel === "string") {
60
+ return defaultModel;
61
+ }
62
+ }
63
+ } catch (error) {
64
+ await client.app.log({
65
+ body: {
66
+ service: "opencode-manifold",
67
+ level: "warn",
68
+ message: `Error getting default model from config: ${error}`
69
+ }
70
+ });
71
+ }
72
+ return "No active model found";
73
+ }
74
+ function setPluginContext2(client) {
75
+ pluginClient2 = client;
76
+ }
77
+ function getModelPathClient() {
78
+ if (!pluginClient2) {
79
+ throw new Error("Plugin client not initialized");
80
+ }
81
+ return pluginClient2;
82
+ }
83
+ var pluginClient2 = null, getModelPathTool;
84
+ var init_get_model_path = __esm(() => {
85
+ getModelPathTool = tool2({
86
+ description: "Returns the model path (provider/model) for the currently active session. Use this to get the correct model string for agent MD file model: attributes.",
87
+ args: {},
88
+ async execute(_args, context) {
89
+ const client = getModelPathClient();
90
+ const modelPath = await getModelPath(client, context.sessionID);
91
+ return modelPath;
92
+ }
93
+ });
94
+ });
95
+
1
96
  // src/init.ts
2
97
  import { readFile, writeFile, mkdir, readdir } from "fs/promises";
3
98
  import { existsSync } from "fs";
@@ -4237,6 +4332,9 @@ ${testResult.result.output}`,
4237
4332
  }
4238
4333
  });
4239
4334
 
4335
+ // src/index.ts
4336
+ init_get_model_path();
4337
+
4240
4338
  // src/tools/set-subagent-model.ts
4241
4339
  import { readFile as readFile5, writeFile as writeFile5, readdir as readdir3 } from "fs/promises";
4242
4340
  import { existsSync as existsSync6 } from "fs";
@@ -4718,6 +4816,7 @@ Your project files (.opencode/, Manifold/) are untouched — only the configured
4718
4816
  // src/index.ts
4719
4817
  var ManifoldPlugin = async (ctx) => {
4720
4818
  setPluginContext(ctx.client);
4819
+ setPluginContext2(ctx.client);
4721
4820
  await ensureGlobalTemplates(ctx);
4722
4821
  await ctx.client.app.log({
4723
4822
  body: {
@@ -4728,7 +4827,8 @@ var ManifoldPlugin = async (ctx) => {
4728
4827
  });
4729
4828
  return {
4730
4829
  tool: {
4731
- dispatchTask: dispatchTaskTool
4830
+ dispatchTask: dispatchTaskTool,
4831
+ getModelPath: getModelPathTool
4732
4832
  },
4733
4833
  "command.execute.before": async (input, output) => {
4734
4834
  if (input.command === "manifold-init") {
@@ -4754,6 +4854,10 @@ var ManifoldPlugin = async (ctx) => {
4754
4854
  } else if (input.command === "manifold-update") {
4755
4855
  await handleUpdateCommand(ctx.client, ctx.directory);
4756
4856
  output.parts = [{ type: "text", text: "Manifold update process started." }];
4857
+ } else if (input.command === "manifold-model-path") {
4858
+ const { getModelPath: getModelPath2 } = await Promise.resolve().then(() => (init_get_model_path(), exports_get_model_path));
4859
+ const modelPath = await getModelPath2(ctx.client, input.sessionID || undefined);
4860
+ output.parts = [{ type: "text", text: modelPath }];
4757
4861
  }
4758
4862
  }
4759
4863
  };
package/dist/tui.js CHANGED
@@ -1,3 +1,98 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true,
11
+ configurable: true,
12
+ set: __exportSetter.bind(all, name)
13
+ });
14
+ };
15
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
16
+
17
+ // src/tools/get-model-path.ts
18
+ var exports_get_model_path = {};
19
+ __export(exports_get_model_path, {
20
+ setPluginContext: () => setPluginContext,
21
+ getModelPathTool: () => getModelPathTool,
22
+ getModelPath: () => getModelPath
23
+ });
24
+ import { tool } from "@opencode-ai/plugin";
25
+ async function getModelPath(client, sessionID) {
26
+ if (sessionID) {
27
+ try {
28
+ const messagesResponse = await client.session.messages({
29
+ path: { id: sessionID }
30
+ });
31
+ if (messagesResponse.data && messagesResponse.data.length > 0) {
32
+ const lastMessage = messagesResponse.data[messagesResponse.data.length - 1];
33
+ if (lastMessage.info) {
34
+ if (lastMessage.info.role === "assistant") {
35
+ const assistantMsg = lastMessage.info;
36
+ return `${assistantMsg.providerID}/${assistantMsg.modelID}`;
37
+ }
38
+ if (lastMessage.info.model) {
39
+ const { providerID, modelID } = lastMessage.info.model;
40
+ return `${providerID}/${modelID}`;
41
+ }
42
+ }
43
+ }
44
+ } catch (error) {
45
+ await client.app.log({
46
+ body: {
47
+ service: "opencode-manifold",
48
+ level: "warn",
49
+ message: `Error getting model from session messages: ${error}`
50
+ }
51
+ });
52
+ }
53
+ }
54
+ try {
55
+ const providersResponse = await client.config.providers({});
56
+ if (providersResponse.data && providersResponse.data.default) {
57
+ const defaults = providersResponse.data.default;
58
+ const defaultModel = defaults["model"] || defaults["small_model"];
59
+ if (defaultModel && typeof defaultModel === "string") {
60
+ return defaultModel;
61
+ }
62
+ }
63
+ } catch (error) {
64
+ await client.app.log({
65
+ body: {
66
+ service: "opencode-manifold",
67
+ level: "warn",
68
+ message: `Error getting default model from config: ${error}`
69
+ }
70
+ });
71
+ }
72
+ return "No active model found";
73
+ }
74
+ function setPluginContext(client) {
75
+ pluginClient = client;
76
+ }
77
+ function getModelPathClient() {
78
+ if (!pluginClient) {
79
+ throw new Error("Plugin client not initialized");
80
+ }
81
+ return pluginClient;
82
+ }
83
+ var pluginClient = null, getModelPathTool;
84
+ var init_get_model_path = __esm(() => {
85
+ getModelPathTool = tool({
86
+ description: "Returns the model path (provider/model) for the currently active session. Use this to get the correct model string for agent MD file model: attributes.",
87
+ args: {},
88
+ async execute(_args, context) {
89
+ const client = getModelPathClient();
90
+ const modelPath = await getModelPath(client, context.sessionID);
91
+ return modelPath;
92
+ }
93
+ });
94
+ });
95
+
1
96
  // node_modules/js-yaml/dist/js-yaml.mjs
2
97
  /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
3
98
  function isNothing(subject) {
@@ -2712,6 +2807,34 @@ var tui = async (api) => {
2712
2807
  slash: {
2713
2808
  name: "manifold-update"
2714
2809
  }
2810
+ },
2811
+ {
2812
+ title: "Get Model Path",
2813
+ value: "manifold-model-path",
2814
+ description: "Return the currently active model path for agent MD files",
2815
+ category: "Manifold",
2816
+ slash: {
2817
+ name: "manifold-model-path"
2818
+ },
2819
+ onSelect: () => {
2820
+ const sessionID = api.state.session?.id;
2821
+ if (!sessionID) {
2822
+ api.ui.toast({
2823
+ variant: "error",
2824
+ message: "No active session"
2825
+ });
2826
+ return;
2827
+ }
2828
+ Promise.resolve().then(() => (init_get_model_path(), exports_get_model_path)).then(({ getModelPath: getModelPath2 }) => {
2829
+ const client = api.client;
2830
+ getModelPath2(client, sessionID).then((modelPath) => {
2831
+ api.ui.toast({
2832
+ variant: "success",
2833
+ message: modelPath
2834
+ });
2835
+ });
2836
+ });
2837
+ }
2715
2838
  }
2716
2839
  ]);
2717
2840
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-manifold",
3
- "version": "0.4.20",
3
+ "version": "0.4.22",
4
4
  "description": "Multi-agent development system for opencode with persistent knowledge",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",