gyoshu 0.4.17 → 0.4.18

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.18",
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.18",
4
4
  "description": "Scientific research agent extension for OpenCode",
5
5
  "files": {
6
6
  "agent": [
package/src/index.ts CHANGED
@@ -867,32 +867,46 @@ function autoInstall(): InstallResult {
867
867
  }
868
868
 
869
869
  export const GyoshuPlugin: Plugin = async (ctx) => {
870
- const installResult = autoInstall();
870
+ // Always return a valid Hooks object, even on error
871
+ const emptyHooks = {};
872
+
873
+ try {
874
+ const installResult = autoInstall();
871
875
 
872
- if (installResult.fatal) {
873
- console.error(`❌ Gyoshu: Fatal installation error`);
874
- for (const error of installResult.errors) {
875
- console.error(` - ${error}`);
876
+ if (installResult.fatal) {
877
+ console.error(`❌ Gyoshu: Fatal installation error`);
878
+ for (const error of installResult.errors) {
879
+ console.error(` - ${error}`);
880
+ }
876
881
  }
877
- return GyoshuHooks(ctx);
878
- }
879
882
 
880
- if (installResult.installed > 0) {
881
- console.log(`🎓 Gyoshu: Installed ${installResult.installed} files to ~/.config/opencode/`);
882
- }
883
+ if (installResult.installed > 0) {
884
+ console.log(`🎓 Gyoshu: Installed ${installResult.installed} files to ~/.config/opencode/`);
885
+ }
883
886
 
884
- if (installResult.updated > 0) {
885
- console.log(`🎓 Gyoshu: Updated ${installResult.updated} files`);
886
- }
887
+ if (installResult.updated > 0) {
888
+ console.log(`🎓 Gyoshu: Updated ${installResult.updated} files`);
889
+ }
887
890
 
888
- if (installResult.errors.length > 0) {
889
- console.warn(`⚠️ Gyoshu: Some issues occurred:`);
890
- for (const error of installResult.errors) {
891
- console.warn(` - ${error}`);
891
+ if (installResult.errors.length > 0) {
892
+ console.warn(`⚠️ Gyoshu: Some issues occurred:`);
893
+ for (const error of installResult.errors) {
894
+ console.warn(` - ${error}`);
895
+ }
892
896
  }
893
- }
894
897
 
895
- return GyoshuHooks(ctx);
898
+ // Try to initialize hooks, return empty hooks on failure
899
+ try {
900
+ const hooks = await GyoshuHooks(ctx);
901
+ return hooks || emptyHooks;
902
+ } catch (hooksError) {
903
+ console.error(`❌ Gyoshu: Failed to initialize hooks: ${hooksError instanceof Error ? hooksError.message : String(hooksError)}`);
904
+ return emptyHooks;
905
+ }
906
+ } catch (err) {
907
+ console.error(`❌ Gyoshu: Plugin initialization failed: ${err instanceof Error ? err.message : String(err)}`);
908
+ return emptyHooks;
909
+ }
896
910
  };
897
911
 
898
912
  export default GyoshuPlugin;