opencode-manifold 0.4.20 → 0.4.21

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
@@ -1,3 +1,92 @@
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 && lastMessage.info.model) {
34
+ const { providerID, modelID } = lastMessage.info.model;
35
+ return `${providerID}/${modelID}`;
36
+ }
37
+ }
38
+ } catch (error) {
39
+ await client.app.log({
40
+ body: {
41
+ service: "opencode-manifold",
42
+ level: "warn",
43
+ message: `Error getting model from session messages: ${error}`
44
+ }
45
+ });
46
+ }
47
+ }
48
+ try {
49
+ const providersResponse = await client.config.providers({});
50
+ if (providersResponse.data && providersResponse.data.default) {
51
+ const defaults = providersResponse.data.default;
52
+ const defaultModel = defaults["model"] || defaults["small_model"];
53
+ if (defaultModel && typeof defaultModel === "string") {
54
+ return defaultModel;
55
+ }
56
+ }
57
+ } catch (error) {
58
+ await client.app.log({
59
+ body: {
60
+ service: "opencode-manifold",
61
+ level: "warn",
62
+ message: `Error getting default model from config: ${error}`
63
+ }
64
+ });
65
+ }
66
+ return "No active model found";
67
+ }
68
+ function setPluginContext2(client) {
69
+ pluginClient2 = client;
70
+ }
71
+ function getModelPathClient() {
72
+ if (!pluginClient2) {
73
+ throw new Error("Plugin client not initialized");
74
+ }
75
+ return pluginClient2;
76
+ }
77
+ var pluginClient2 = null, getModelPathTool;
78
+ var init_get_model_path = __esm(() => {
79
+ getModelPathTool = tool2({
80
+ 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.",
81
+ args: {},
82
+ async execute(_args, context) {
83
+ const client = getModelPathClient();
84
+ const modelPath = await getModelPath(client, context.sessionID);
85
+ return modelPath;
86
+ }
87
+ });
88
+ });
89
+
1
90
  // src/init.ts
2
91
  import { readFile, writeFile, mkdir, readdir } from "fs/promises";
3
92
  import { existsSync } from "fs";
@@ -4237,6 +4326,9 @@ ${testResult.result.output}`,
4237
4326
  }
4238
4327
  });
4239
4328
 
4329
+ // src/index.ts
4330
+ init_get_model_path();
4331
+
4240
4332
  // src/tools/set-subagent-model.ts
4241
4333
  import { readFile as readFile5, writeFile as writeFile5, readdir as readdir3 } from "fs/promises";
4242
4334
  import { existsSync as existsSync6 } from "fs";
@@ -4718,6 +4810,7 @@ Your project files (.opencode/, Manifold/) are untouched — only the configured
4718
4810
  // src/index.ts
4719
4811
  var ManifoldPlugin = async (ctx) => {
4720
4812
  setPluginContext(ctx.client);
4813
+ setPluginContext2(ctx.client);
4721
4814
  await ensureGlobalTemplates(ctx);
4722
4815
  await ctx.client.app.log({
4723
4816
  body: {
@@ -4728,7 +4821,8 @@ var ManifoldPlugin = async (ctx) => {
4728
4821
  });
4729
4822
  return {
4730
4823
  tool: {
4731
- dispatchTask: dispatchTaskTool
4824
+ dispatchTask: dispatchTaskTool,
4825
+ getModelPath: getModelPathTool
4732
4826
  },
4733
4827
  "command.execute.before": async (input, output) => {
4734
4828
  if (input.command === "manifold-init") {
@@ -4754,6 +4848,10 @@ var ManifoldPlugin = async (ctx) => {
4754
4848
  } else if (input.command === "manifold-update") {
4755
4849
  await handleUpdateCommand(ctx.client, ctx.directory);
4756
4850
  output.parts = [{ type: "text", text: "Manifold update process started." }];
4851
+ } else if (input.command === "manifold-model-path") {
4852
+ const { getModelPath: getModelPath2 } = await Promise.resolve().then(() => (init_get_model_path(), exports_get_model_path));
4853
+ const modelPath = await getModelPath2(ctx.client, input.sessionID || undefined);
4854
+ output.parts = [{ type: "text", text: modelPath }];
4757
4855
  }
4758
4856
  }
4759
4857
  };
package/dist/tui.js CHANGED
@@ -1,3 +1,92 @@
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 && lastMessage.info.model) {
34
+ const { providerID, modelID } = lastMessage.info.model;
35
+ return `${providerID}/${modelID}`;
36
+ }
37
+ }
38
+ } catch (error) {
39
+ await client.app.log({
40
+ body: {
41
+ service: "opencode-manifold",
42
+ level: "warn",
43
+ message: `Error getting model from session messages: ${error}`
44
+ }
45
+ });
46
+ }
47
+ }
48
+ try {
49
+ const providersResponse = await client.config.providers({});
50
+ if (providersResponse.data && providersResponse.data.default) {
51
+ const defaults = providersResponse.data.default;
52
+ const defaultModel = defaults["model"] || defaults["small_model"];
53
+ if (defaultModel && typeof defaultModel === "string") {
54
+ return defaultModel;
55
+ }
56
+ }
57
+ } catch (error) {
58
+ await client.app.log({
59
+ body: {
60
+ service: "opencode-manifold",
61
+ level: "warn",
62
+ message: `Error getting default model from config: ${error}`
63
+ }
64
+ });
65
+ }
66
+ return "No active model found";
67
+ }
68
+ function setPluginContext(client) {
69
+ pluginClient = client;
70
+ }
71
+ function getModelPathClient() {
72
+ if (!pluginClient) {
73
+ throw new Error("Plugin client not initialized");
74
+ }
75
+ return pluginClient;
76
+ }
77
+ var pluginClient = null, getModelPathTool;
78
+ var init_get_model_path = __esm(() => {
79
+ getModelPathTool = tool({
80
+ 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.",
81
+ args: {},
82
+ async execute(_args, context) {
83
+ const client = getModelPathClient();
84
+ const modelPath = await getModelPath(client, context.sessionID);
85
+ return modelPath;
86
+ }
87
+ });
88
+ });
89
+
1
90
  // node_modules/js-yaml/dist/js-yaml.mjs
2
91
  /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
3
92
  function isNothing(subject) {
@@ -2712,6 +2801,34 @@ var tui = async (api) => {
2712
2801
  slash: {
2713
2802
  name: "manifold-update"
2714
2803
  }
2804
+ },
2805
+ {
2806
+ title: "Get Model Path",
2807
+ value: "manifold-model-path",
2808
+ description: "Return the currently active model path for agent MD files",
2809
+ category: "Manifold",
2810
+ slash: {
2811
+ name: "manifold-model-path"
2812
+ },
2813
+ onSelect: () => {
2814
+ const sessionID = api.state.session?.id;
2815
+ if (!sessionID) {
2816
+ api.ui.toast({
2817
+ variant: "error",
2818
+ message: "No active session"
2819
+ });
2820
+ return;
2821
+ }
2822
+ Promise.resolve().then(() => (init_get_model_path(), exports_get_model_path)).then(({ getModelPath: getModelPath2 }) => {
2823
+ const client = api.client;
2824
+ getModelPath2(client, sessionID).then((modelPath) => {
2825
+ api.ui.toast({
2826
+ variant: "success",
2827
+ message: modelPath
2828
+ });
2829
+ });
2830
+ });
2831
+ }
2715
2832
  }
2716
2833
  ]);
2717
2834
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-manifold",
3
- "version": "0.4.20",
3
+ "version": "0.4.21",
4
4
  "description": "Multi-agent development system for opencode with persistent knowledge",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",