gyoshu 0.4.17 → 0.4.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gyoshu",
3
- "version": "0.4.17",
3
+ "version": "0.4.19",
4
4
  "description": "Scientific research agent extension for OpenCode - turns research goals into reproducible Jupyter notebooks",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gyoshu",
3
- "version": "0.4.17",
3
+ "version": "0.4.19",
4
4
  "description": "Scientific research agent extension for OpenCode",
5
5
  "files": {
6
6
  "agent": [
package/src/index.ts CHANGED
@@ -8,7 +8,6 @@ import { readFileNoFollowSync, openNoFollowSync } from "./lib/atomic-write";
8
8
  import { ensureDirSync, validatePathSegment } from "./lib/paths";
9
9
 
10
10
  import manifest from "./gyoshu-manifest.json";
11
- import { GyoshuPlugin as GyoshuHooks } from "./plugin/gyoshu-hooks";
12
11
 
13
12
  const OPENCODE_CONFIG = path.join(homedir(), ".config", "opencode");
14
13
  const GYOSHU_STATE_DIR = path.join(OPENCODE_CONFIG, ".gyoshu");
@@ -867,32 +866,46 @@ function autoInstall(): InstallResult {
867
866
  }
868
867
 
869
868
  export const GyoshuPlugin: Plugin = async (ctx) => {
870
- const installResult = autoInstall();
869
+ // Always return a valid Hooks object, even on error
870
+ const emptyHooks = {};
871
+
872
+ try {
873
+ const installResult = autoInstall();
871
874
 
872
- if (installResult.fatal) {
873
- console.error(`❌ Gyoshu: Fatal installation error`);
874
- for (const error of installResult.errors) {
875
- console.error(` - ${error}`);
875
+ if (installResult.fatal) {
876
+ console.error(`❌ Gyoshu: Fatal installation error`);
877
+ for (const error of installResult.errors) {
878
+ console.error(` - ${error}`);
879
+ }
876
880
  }
877
- return GyoshuHooks(ctx);
878
- }
879
881
 
880
- if (installResult.installed > 0) {
881
- console.log(`🎓 Gyoshu: Installed ${installResult.installed} files to ~/.config/opencode/`);
882
- }
882
+ if (installResult.installed > 0) {
883
+ console.log(`🎓 Gyoshu: Installed ${installResult.installed} files to ~/.config/opencode/`);
884
+ }
883
885
 
884
- if (installResult.updated > 0) {
885
- console.log(`🎓 Gyoshu: Updated ${installResult.updated} files`);
886
- }
886
+ if (installResult.updated > 0) {
887
+ console.log(`🎓 Gyoshu: Updated ${installResult.updated} files`);
888
+ }
887
889
 
888
- if (installResult.errors.length > 0) {
889
- console.warn(`⚠️ Gyoshu: Some issues occurred:`);
890
- for (const error of installResult.errors) {
891
- console.warn(` - ${error}`);
890
+ if (installResult.errors.length > 0) {
891
+ console.warn(`⚠️ Gyoshu: Some issues occurred:`);
892
+ for (const error of installResult.errors) {
893
+ console.warn(` - ${error}`);
894
+ }
892
895
  }
893
- }
894
896
 
895
- return GyoshuHooks(ctx);
897
+ try {
898
+ const { GyoshuPlugin: GyoshuHooks } = await import("./plugin/gyoshu-hooks");
899
+ const hooks = await GyoshuHooks(ctx);
900
+ return hooks || emptyHooks;
901
+ } catch (hooksError) {
902
+ console.error(`❌ Gyoshu: Failed to initialize hooks: ${hooksError instanceof Error ? hooksError.message : String(hooksError)}`);
903
+ return emptyHooks;
904
+ }
905
+ } catch (err) {
906
+ console.error(`❌ Gyoshu: Plugin initialization failed: ${err instanceof Error ? err.message : String(err)}`);
907
+ return emptyHooks;
908
+ }
896
909
  };
897
910
 
898
911
  export default GyoshuPlugin;