@magnitudedev/pi-extension 0.0.2 → 0.0.3

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.
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@magnitudedev/pi-extension",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "rpcVersion": 1,
5
- "contentFingerprint": "eb4eac2538369de2dabb2c65f7ac94bd518c5de6bfc26d12af33cad167a6748a",
5
+ "contentFingerprint": "8de1ffd943ecccad03f811d1b61bad853c2f0fb249308e8aecd00a8a504ed7fd",
6
6
  "files": {
7
7
  "README.md": "c6a121075d1ccacc4db063dd8ff1a336a04f77a7f444acba12e1628df32fa3f5",
8
- "dist/magnitude.js": "d741bd337e8ba28984303fcfa059e106afd331adce214c276f4478b3978b00d7",
8
+ "dist/magnitude.js": "e23b9692b7cd00bd01a68ba1bfd2c32a83c22017fa964008049b5de30c35a5cb",
9
9
  "dist/skills/magnitude/SKILL.md": "37de67f0c7b831415f6298c8785b7ae97d5cfe454dc778651d96114840d2ace2"
10
10
  }
11
11
  }
package/dist/magnitude.js CHANGED
@@ -5985,18 +5985,21 @@ var PiSetupLive = Layer6.effect(PiSetup, Effect12.gen(function* () {
5985
5985
  const fs = yield* FileSystem.FileSystem;
5986
5986
  const executor = yield* CommandExecutor3.CommandExecutor;
5987
5987
  return {
5988
- run: (ctx) => Effect12.scoped(Effect12.gen(function* () {
5988
+ run: (ctx, activateModel) => Effect12.scoped(Effect12.gen(function* () {
5989
5989
  const executable = yield* withPiPreparation(ctx, (setMessage) => prepareMagnitudeCli(ctx.cwd, setMessage));
5990
- const termination = yield* withPiTerminal(ctx, runInteractiveProcess({
5991
- executable,
5992
- args: ["setup", "--host", "pi"],
5993
- environment: process.env,
5994
- workingDirectory: ctx.cwd
5990
+ return yield* withPiTerminal(ctx, Effect12.gen(function* () {
5991
+ const termination = yield* runInteractiveProcess({
5992
+ executable,
5993
+ args: ["setup", "--host", "pi"],
5994
+ environment: process.env,
5995
+ workingDirectory: ctx.cwd
5996
+ });
5997
+ if (!(yield* validateSetupTermination(termination)))
5998
+ return { _tag: "Cancelled" };
5999
+ const modelId = yield* readSetupModel.pipe(Effect12.provide(MagnitudeClient.layer({ autoStart: false }).pipe(Layer6.provide(FetchHttpClient2.layer))));
6000
+ yield* activateModel(modelId);
6001
+ return { _tag: "Completed", modelId };
5995
6002
  }));
5996
- if (!(yield* validateSetupTermination(termination)))
5997
- return { _tag: "Cancelled" };
5998
- const modelId = yield* readSetupModel.pipe(Effect12.provide(MagnitudeClient.layer({ autoStart: false }).pipe(Layer6.provide(FetchHttpClient2.layer))));
5999
- return { _tag: "Completed", modelId };
6000
6003
  })).pipe(Effect12.provideService(CommandExecutor3.CommandExecutor, executor), Effect12.provideService(FileSystem.FileSystem, fs), Effect12.mapError((error) => error instanceof PiSetupFailed ? error : failure(`Magnitude setup could not finish: ${String(error)}`)))
6001
6004
  };
6002
6005
  }));
@@ -6010,19 +6013,16 @@ var registerMagnitudeSetup = (pi, layer4 = PiSetupLive.pipe(Layer6.provide(NodeC
6010
6013
  if (!ctx.isIdle() || ctx.hasPendingMessages())
6011
6014
  return yield* failure("Wait for the current task to finish, then run /magnitude-setup.");
6012
6015
  const setup = yield* PiSetup;
6013
- const result = yield* setup.run(ctx);
6014
- if (result._tag !== "Completed")
6015
- return false;
6016
- yield* Effect12.tryPromise({
6016
+ const result = yield* setup.run(ctx, (modelId) => Effect12.tryPromise({
6017
6017
  try: async () => {
6018
6018
  await ctx.modelRegistry.refresh();
6019
- const model2 = ctx.modelRegistry.find("magnitude", result.modelId);
6019
+ const model2 = ctx.modelRegistry.find("magnitude", modelId);
6020
6020
  if (!model2 || !await pi.setModel(model2))
6021
6021
  throw new Error("The selected model is not available in Pi");
6022
6022
  },
6023
6023
  catch: (error) => failure(`Magnitude setup completed, but Pi could not activate the model: ${String(error)}. Run /reload and select it with /model.`)
6024
- });
6025
- return true;
6024
+ }));
6025
+ return result._tag === "Completed";
6026
6026
  });
6027
6027
  const run = (ctx) => runtime.runPromise(Effect12.forkIn(gate.withPermitsIfAvailable(1)(action(ctx)).pipe(Effect12.flatMap((result) => result._tag === "Some" ? Effect12.succeed(result.value) : Effect12.fail(failure("Magnitude setup is already open."))), Effect12.catchAll((error) => Effect12.sync(() => {
6028
6028
  ctx.ui.notify(error.message, "error");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magnitudedev/pi-extension",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Run local AI models in Pi with Magnitude",
5
5
  "type": "module",
6
6
  "license": "MIT",