@moxt-ai/mobius 0.0.182 → 0.0.183

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/runtime.js CHANGED
@@ -23106,6 +23106,7 @@ function sessionFailureMeta(failure2) {
23106
23106
  import { spawn as spawn2 } from "node:child_process";
23107
23107
 
23108
23108
  // src/acp/codex/app-server-protocol.ts
23109
+ import { isAbsolute as isAbsolute2 } from "node:path";
23109
23110
  var boundedText = (maximum) => external_exports.string().max(maximum);
23110
23111
  var jsonValue = external_exports.lazy(() => external_exports.unknown());
23111
23112
  var requestIdSchema = external_exports.union([external_exports.number(), external_exports.string()]).refine((value) => typeof value === "number" || value.length <= 256);
@@ -23176,6 +23177,7 @@ var imageGenerationItemSchema = external_exports.object({
23176
23177
  });
23177
23178
  var threadItemSchema = external_exports.discriminatedUnion("type", [
23178
23179
  imageGenerationItemSchema,
23180
+ external_exports.object({ type: external_exports.literal("imageView"), id: boundedText(256), path: boundedText(32768).refine(isAbsolute2) }),
23179
23181
  external_exports.object({
23180
23182
  id: boundedText(256),
23181
23183
  text: boundedText(1e6),
@@ -23600,6 +23602,7 @@ var CodexAppServerClient = class {
23600
23602
  };
23601
23603
 
23602
23604
  // src/acp/codex/items.ts
23605
+ import { pathToFileURL } from "node:url";
23603
23606
  var TOOL_OUTPUT_CHARACTER_LIMIT = 32768;
23604
23607
  var TITLE_CHARACTER_LIMIT = 500;
23605
23608
  function truncate2(value, limit) {
@@ -23621,6 +23624,14 @@ function textContent(text2) {
23621
23624
  const block = { text: truncate2(text2, TOOL_OUTPUT_CHARACTER_LIMIT), type: "text" };
23622
23625
  return { content: block, type: "content" };
23623
23626
  }
23627
+ function structuredToolText(value) {
23628
+ const result = external_exports.object({ content: external_exports.array(external_exports.unknown()) }).safeParse(value);
23629
+ const items = Array.isArray(value) ? value : result.success ? result.data.content : [];
23630
+ return items.flatMap((item) => {
23631
+ const text2 = external_exports.object({ type: external_exports.enum(["text", "inputText"]), text: external_exports.string() }).safeParse(item);
23632
+ return text2.success ? [textContent(text2.data.text)] : [];
23633
+ });
23634
+ }
23624
23635
  function firstLine(value) {
23625
23636
  const line = value.split("\n", 1)[0] ?? "";
23626
23637
  return line.trim().length > 0 ? line.trim() : value.trim();
@@ -23641,6 +23652,22 @@ function mcpStatus(status) {
23641
23652
  return status === "inProgress" ? "in_progress" : status === "completed" ? "completed" : "failed";
23642
23653
  }
23643
23654
  function presentToolItem(item) {
23655
+ if (item.type === "imageView") {
23656
+ return {
23657
+ content: [
23658
+ {
23659
+ type: "content",
23660
+ content: { type: "image", data: "", mimeType: "", uri: pathToFileURL(item.path).href }
23661
+ }
23662
+ ],
23663
+ kind: "read",
23664
+ locations: [{ path: item.path }],
23665
+ rawInput: { path: item.path },
23666
+ rawOutput: null,
23667
+ status: "completed",
23668
+ title: "View image"
23669
+ };
23670
+ }
23644
23671
  if (item.type === "imageGeneration") {
23645
23672
  const failed = item.failure != null || item.status === "failed";
23646
23673
  const content = [];
@@ -23705,13 +23732,7 @@ function presentToolItem(item) {
23705
23732
  }
23706
23733
  if (item.type === "mcpToolCall") {
23707
23734
  const label = `${item.server}/${item.tool}`;
23708
- const content = [];
23709
- if (item.result != null) {
23710
- content.push(textContent(JSON.stringify(item.result)));
23711
- }
23712
- if (item.error != null) {
23713
- content.push(textContent(JSON.stringify(item.error)));
23714
- }
23735
+ const content = structuredToolText(item.error ?? item.result);
23715
23736
  return {
23716
23737
  content,
23717
23738
  kind: "other",
@@ -23724,13 +23745,13 @@ function presentToolItem(item) {
23724
23745
  }
23725
23746
  if (item.type === "dynamicToolCall") {
23726
23747
  const label = item.namespace == null ? item.tool : `${item.namespace}/${item.tool}`;
23727
- const content = (item.contentItems ?? []).map((entry) => textContent(JSON.stringify(entry)));
23748
+ const content = structuredToolText(item.contentItems);
23728
23749
  return {
23729
23750
  content,
23730
23751
  kind: "other",
23731
23752
  locations: [],
23732
23753
  rawInput: item.arguments ?? null,
23733
- rawOutput: item.success === true ? null : item.contentItems ?? null,
23754
+ rawOutput: item.contentItems ?? null,
23734
23755
  status: mcpStatus(item.status),
23735
23756
  title: truncate2(label, TITLE_CHARACTER_LIMIT)
23736
23757
  };
@@ -23743,12 +23764,12 @@ function toolCallUpdate(item, lifecycle) {
23743
23764
  return null;
23744
23765
  }
23745
23766
  return {
23746
- content: [...presentation.content],
23767
+ content: item.type === "imageView" && lifecycle === "started" ? [] : [...presentation.content],
23747
23768
  kind: presentation.kind,
23748
23769
  locations: [...presentation.locations],
23749
23770
  rawInput: presentation.rawInput,
23750
23771
  rawOutput: presentation.rawOutput,
23751
- status: lifecycle === "completed" && presentation.status === "in_progress" ? "completed" : presentation.status,
23772
+ status: item.type === "imageView" && lifecycle === "started" ? "in_progress" : lifecycle === "completed" && presentation.status === "in_progress" ? "completed" : presentation.status,
23752
23773
  title: presentation.title,
23753
23774
  toolCallId: item.id
23754
23775
  };
@@ -24972,12 +24993,12 @@ var AgentProbeError = class extends Error {
24972
24993
  };
24973
24994
 
24974
24995
  // src/agent-catalog/agents/resolve-user-local-executable.ts
24975
- import { isAbsolute as isAbsolute2, join as join4 } from "node:path";
24996
+ import { isAbsolute as isAbsolute3, join as join4 } from "node:path";
24976
24997
  async function resolveUserLocalExecutable(executableName, context) {
24977
24998
  context.signal.throwIfAborted();
24978
24999
  const platform = context.platform ?? process.platform;
24979
25000
  const homeDirectory = context.environment["HOME"];
24980
- if (platform === "win32" || homeDirectory === void 0 || !isAbsolute2(homeDirectory)) {
25001
+ if (platform === "win32" || homeDirectory === void 0 || !isAbsolute3(homeDirectory)) {
24981
25002
  return [];
24982
25003
  }
24983
25004
  const executable = await resolveExecutablePath(join4(homeDirectory, ".local", "bin", executableName), platform);
@@ -25070,7 +25091,7 @@ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
25070
25091
 
25071
25092
  // src/agent-catalog/agents/deepseek-harness-agent.ts
25072
25093
  import { mkdir as mkdir2, realpath as realpath3, stat as stat3, writeFile } from "node:fs/promises";
25073
- import { isAbsolute as isAbsolute3, join as join6, normalize } from "node:path";
25094
+ import { isAbsolute as isAbsolute4, join as join6, normalize } from "node:path";
25074
25095
 
25075
25096
  // src/agent-installation/deepseek-managed-package.ts
25076
25097
  var DeepSeekHarnessManagedPackage = class extends SriManagedNpmPackageDefinition {
@@ -25105,7 +25126,7 @@ var DEEPSEEK_HARNESS_IMAGE_PROMPT_PATCH = `# Managed by Mobius: pin the ACP brid
25105
25126
  model: deepseek-v4-flash-vision-exp
25106
25127
  `;
25107
25128
  async function prepareAgentHome(path2, imagePrompts) {
25108
- if (!isAbsolute3(path2) || normalize(path2) !== path2) {
25129
+ if (!isAbsolute4(path2) || normalize(path2) !== path2) {
25109
25130
  throw new AgentProbeError("agent_environment_invalid", "The configured Agent home is invalid");
25110
25131
  }
25111
25132
  try {
@@ -25237,7 +25258,7 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
25237
25258
 
25238
25259
  // src/agent-catalog/agents/grok-build-agent.ts
25239
25260
  import { realpath as realpath4 } from "node:fs/promises";
25240
- import { isAbsolute as isAbsolute4, join as join7, relative as relative2, sep as sep2 } from "node:path";
25261
+ import { isAbsolute as isAbsolute5, join as join7, relative as relative2, sep as sep2 } from "node:path";
25241
25262
  import {
25242
25263
  RequestError
25243
25264
  } from "@agentclientprotocol/sdk";
@@ -25303,7 +25324,7 @@ function grokBuildManagedPackage(platform, architecture) {
25303
25324
  // src/agent-catalog/agents/grok-build-agent.ts
25304
25325
  function isContainedPath2(root, candidate) {
25305
25326
  const difference = relative2(root, candidate);
25306
- return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep2}`) && !isAbsolute4(difference);
25327
+ return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep2}`) && !isAbsolute5(difference);
25307
25328
  }
25308
25329
  var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
25309
25330
  adapterVersion = GROK_BUILD_MANAGED_VERSION;
@@ -25452,7 +25473,7 @@ import { join as join9 } from "node:path";
25452
25473
  import { createHash } from "node:crypto";
25453
25474
  import { createReadStream } from "node:fs";
25454
25475
  import { chmod, copyFile, mkdir as mkdir3, mkdtemp as mkdtemp2, open as open3, realpath as realpath5, rename as rename2, rm as rm2, stat as stat4, writeFile as writeFile2 } from "node:fs/promises";
25455
- import { delimiter as delimiter2, dirname as dirname2, isAbsolute as isAbsolute5, join as join8, relative as relative3, sep as sep3 } from "node:path";
25476
+ import { delimiter as delimiter2, dirname as dirname2, isAbsolute as isAbsolute6, join as join8, relative as relative3, sep as sep3 } from "node:path";
25456
25477
 
25457
25478
  // src/agent-installation/verified-download.ts
25458
25479
  import { fetch } from "undici";
@@ -25558,7 +25579,7 @@ function isRecord5(value) {
25558
25579
  }
25559
25580
  function isContainedPath3(root, candidate) {
25560
25581
  const difference = relative3(root, candidate);
25561
- return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep3}`) && !isAbsolute5(difference);
25582
+ return difference.length > 0 && difference !== ".." && !difference.startsWith(`..${sep3}`) && !isAbsolute6(difference);
25562
25583
  }
25563
25584
  async function hashFile(path2, signal) {
25564
25585
  signal.throwIfAborted();
@@ -25948,7 +25969,7 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
25948
25969
  };
25949
25970
 
25950
25971
  // src/agent-catalog/agents/workbuddy-agent.ts
25951
- import { isAbsolute as isAbsolute6, join as join11 } from "node:path";
25972
+ import { isAbsolute as isAbsolute7, join as join11 } from "node:path";
25952
25973
 
25953
25974
  // src/agent-installation/workbuddy-managed-package.ts
25954
25975
  var WORKBUDDY_MANAGED_VERSION = "2.146.0";
@@ -26016,7 +26037,7 @@ var WorkBuddyAgentSpecification = class extends DirectAcpAgentDefinition {
26016
26037
  }
26017
26038
  const requestedPaths = [join11("/Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH)];
26018
26039
  const homeDirectory = context.environment["HOME"];
26019
- if (homeDirectory !== void 0 && isAbsolute6(homeDirectory)) {
26040
+ if (homeDirectory !== void 0 && isAbsolute7(homeDirectory)) {
26020
26041
  requestedPaths.unshift(join11(homeDirectory, "Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH));
26021
26042
  }
26022
26043
  const executables = [];
@@ -26381,7 +26402,7 @@ function isAgentVersionSupported(reportedVersion, minimumSupportedVersion) {
26381
26402
  }
26382
26403
 
26383
26404
  // src/agent-catalog/executable-discovery.ts
26384
- import { isAbsolute as isAbsolute7, join as join13 } from "node:path";
26405
+ import { isAbsolute as isAbsolute8, join as join13 } from "node:path";
26385
26406
 
26386
26407
  // src/agent-installation/managed-adapter-installer.ts
26387
26408
  import { join as join12 } from "node:path";
@@ -26486,7 +26507,7 @@ async function resolveManagedAdapterExecutable(specification, context) {
26486
26507
  async function resolveSpecificationExecutables(executableName, overrideVariable, resolveInstalled, resolveManaged, context) {
26487
26508
  const override = context.environment[overrideVariable];
26488
26509
  if (override !== void 0) {
26489
- if (override.length === 0 || !isAbsolute7(override)) {
26510
+ if (override.length === 0 || !isAbsolute8(override)) {
26490
26511
  return [];
26491
26512
  }
26492
26513
  const executable = await resolveExecutablePath(override, context.platform);
@@ -26948,7 +26969,7 @@ import {
26948
26969
 
26949
26970
  // src/authorization/local-raster.ts
26950
26971
  import { open as open4, readFile as readFile2, realpath as realpath6, stat as stat5 } from "node:fs/promises";
26951
- import { basename, isAbsolute as isAbsolute8, normalize as normalize2 } from "node:path";
26972
+ import { basename, isAbsolute as isAbsolute9, normalize as normalize2 } from "node:path";
26952
26973
  import { fileURLToPath } from "node:url";
26953
26974
  var MAX_LOCAL_RASTER_BYTES = 128 * 1024 * 1024;
26954
26975
  var MAX_INLINE_RASTER_BYTES = 3e6;
@@ -27014,13 +27035,13 @@ function readInlineRaster(data, name2 = "Image") {
27014
27035
  }
27015
27036
  async function resolveCanonicalPath(requested, signal) {
27016
27037
  signal.throwIfAborted();
27017
- if (!isAbsolute8(requested) || requested.includes("\0") || normalize2(requested) !== requested) {
27038
+ if (!isAbsolute9(requested) || requested.includes("\0") || normalize2(requested) !== requested) {
27018
27039
  return null;
27019
27040
  }
27020
27041
  try {
27021
27042
  const target = await realpath6(requested);
27022
27043
  signal.throwIfAborted();
27023
- if (!isAbsolute8(target) || normalize2(target) !== target) {
27044
+ if (!isAbsolute9(target) || normalize2(target) !== target) {
27024
27045
  return null;
27025
27046
  }
27026
27047
  return target;
@@ -35748,8 +35769,15 @@ var embeddedImageSchema = external_exports.looseObject({
35748
35769
  data: external_exports.string(),
35749
35770
  mimeType: external_exports.string()
35750
35771
  });
35772
+ var inlineImageUrlSchema = external_exports.string().regex(/^data:image\/(?:png|jpeg|gif|webp);base64,/u).transform((url2) => ({
35773
+ type: "image",
35774
+ data: url2.slice(url2.indexOf(",") + 1),
35775
+ mimeType: url2.slice(5, url2.indexOf(";"))
35776
+ }));
35751
35777
  var toolImageSchema = external_exports.union([
35752
35778
  embeddedImageSchema,
35779
+ external_exports.object({ type: external_exports.literal("file"), mime: external_exports.string(), url: inlineImageUrlSchema }).refine(({ mime, url: url2 }) => mime === url2.mimeType).transform(({ url: url2 }) => url2),
35780
+ external_exports.object({ type: external_exports.literal("inputImage"), imageUrl: inlineImageUrlSchema }).transform(({ imageUrl }) => imageUrl),
35753
35781
  external_exports.object({
35754
35782
  type: external_exports.literal("image"),
35755
35783
  source: external_exports.object({ type: external_exports.literal("base64"), data: external_exports.string(), media_type: external_exports.string() })
@@ -37556,7 +37584,7 @@ var FixedInstallationExecutor = class {
37556
37584
  // src/authorization/workspace-directory.ts
37557
37585
  import { readdir as readdir3, realpath as realpath8, stat as stat7 } from "node:fs/promises";
37558
37586
  import { homedir as homedir2 } from "node:os";
37559
- import { basename as basename3, dirname as dirname4, isAbsolute as isAbsolute9, join as join16, normalize as normalize3, relative as relative4 } from "node:path";
37587
+ import { basename as basename3, dirname as dirname4, isAbsolute as isAbsolute10, join as join16, normalize as normalize3, relative as relative4 } from "node:path";
37560
37588
 
37561
37589
  // src/authorization/local-authorization-error.ts
37562
37590
  var LocalAuthorizationError = class extends Error {
@@ -37623,7 +37651,7 @@ var WorkspaceDirectoryService = class {
37623
37651
  }
37624
37652
  if (id.startsWith("path-")) {
37625
37653
  const path2 = expandCurrentUserHome(decodePath(id, "path-"));
37626
- if (isAbsolute9(path2)) {
37654
+ if (isAbsolute10(path2)) {
37627
37655
  return path2;
37628
37656
  }
37629
37657
  }
@@ -37631,7 +37659,7 @@ var WorkspaceDirectoryService = class {
37631
37659
  };
37632
37660
  resolvePath = async (requested, signal) => {
37633
37661
  signal.throwIfAborted();
37634
- if (!isAbsolute9(requested) || requested.includes("\0") || normalize3(requested) !== requested) {
37662
+ if (!isAbsolute10(requested) || requested.includes("\0") || normalize3(requested) !== requested) {
37635
37663
  throw new LocalAuthorizationError("The local directory path is invalid");
37636
37664
  }
37637
37665
  try {
@@ -37639,7 +37667,7 @@ var WorkspaceDirectoryService = class {
37639
37667
  signal.throwIfAborted();
37640
37668
  const metadata = await stat7(target);
37641
37669
  signal.throwIfAborted();
37642
- if (!isAbsolute9(target) || normalize3(target) !== target || !metadata.isDirectory()) {
37670
+ if (!isAbsolute10(target) || normalize3(target) !== target || !metadata.isDirectory()) {
37643
37671
  throw new LocalAuthorizationError("The selected location is not a directory");
37644
37672
  }
37645
37673
  return target;
@@ -37655,7 +37683,7 @@ var WorkspaceDirectoryService = class {
37655
37683
  };
37656
37684
  label = (path2) => {
37657
37685
  const suffix = relative4(homedir2(), path2);
37658
- return suffix === "" ? "~" : !isAbsolute9(suffix) && suffix !== ".." && !suffix.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) ? `~/${suffix.replaceAll("\\", "/")}` : path2;
37686
+ return suffix === "" ? "~" : !isAbsolute10(suffix) && suffix !== ".." && !suffix.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) ? `~/${suffix.replaceAll("\\", "/")}` : path2;
37659
37687
  };
37660
37688
  identify = async (bindingId, requestedPath2, signal) => {
37661
37689
  this.authorizeMachine(bindingId);
@@ -40733,7 +40761,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
40733
40761
  // src/artifacts/local-file-streamer.ts
40734
40762
  import { createReadStream as createReadStream2 } from "node:fs";
40735
40763
  import { realpath as realpath9, stat as stat8 } from "node:fs/promises";
40736
- import { basename as basename4, isAbsolute as isAbsolute10, normalize as normalize4, resolve as resolve5 } from "node:path";
40764
+ import { basename as basename4, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve5 } from "node:path";
40737
40765
  import { fileURLToPath as fileURLToPath2 } from "node:url";
40738
40766
  var CHUNK_BYTES = 192 * 1024;
40739
40767
  function requestedPath(value) {
@@ -40752,17 +40780,17 @@ function requestedPath(value) {
40752
40780
  }
40753
40781
  async function resolveFile(value, workingDirectory, signal) {
40754
40782
  const path2 = requestedPath(value);
40755
- if (path2 === null || !isAbsolute10(path2) && workingDirectory === null) {
40783
+ if (path2 === null || !isAbsolute11(path2) && workingDirectory === null) {
40756
40784
  return null;
40757
40785
  }
40758
40786
  const requested = workingDirectory === null ? path2 : resolve5(workingDirectory, path2);
40759
- if (!isAbsolute10(requested) || isAbsolute10(path2) && normalize4(path2) !== path2) {
40787
+ if (!isAbsolute11(requested) || isAbsolute11(path2) && normalize4(path2) !== path2) {
40760
40788
  return null;
40761
40789
  }
40762
40790
  try {
40763
40791
  const target = await realpath9(requested);
40764
40792
  signal.throwIfAborted();
40765
- return isAbsolute10(target) && normalize4(target) === target ? target : null;
40793
+ return isAbsolute11(target) && normalize4(target) === target ? target : null;
40766
40794
  } catch {
40767
40795
  signal.throwIfAborted();
40768
40796
  return null;