@mytegroupinc/myte-core 0.0.36 → 0.0.37

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/README.md CHANGED
@@ -31,6 +31,10 @@ This package exists so the public wrapper can stay small and versioned cleanly.
31
31
  run, it installs the branded MyteCody engine from the Myte release manifest
32
32
  into a user-local Myte cache after signature/hash checks. Coding execution
33
33
  requires that engine, a reachable Myte AI Cody gateway, and `MYTEAI_API_KEY`.
34
+ - `mytecody doctor` reports both the signed MyteCody engine state and this npm
35
+ package version. `mytecody update` updates the engine only. Use
36
+ `npm install -g myte@latest` to update the launcher and the Myte API CLI
37
+ commands shipped by npm.
34
38
  - The package does not bundle the large MyteCody engine binary. See
35
39
  `THIRD_PARTY_NOTICES.md` and `TRADEMARKS.md` for Codex lineage and Myte brand
36
40
  notices.
package/mytecody-cli.js CHANGED
@@ -13,13 +13,17 @@ const {
13
13
  } = require("./lib/ai-gateway");
14
14
  const { createMyteSplash } = require("./lib/mytecody-splash");
15
15
 
16
+ const PACKAGE_NAME = "myte";
16
17
  const PACKAGE_VERSION = require("./package.json").version;
18
+ const DEFAULT_PACKAGE_LATEST_URL = "https://registry.npmjs.org/myte/latest";
17
19
  const DEFAULT_CHANNEL = "alpha";
18
20
  const DEFAULT_MODEL_ALIAS = "myte";
19
21
  const DEFAULT_CONTEXT_WINDOW = Number(process.env.MYTE_CODY_CONTEXT_WINDOW || 49152);
20
22
  const DEFAULT_AUTO_COMPACT_TOKENS = Number(process.env.MYTE_CODY_AUTO_COMPACT_TOKENS || 40960);
21
23
  const DEFAULT_TOOL_OUTPUT_TOKENS = Number(process.env.MYTE_CODY_TOOL_OUTPUT_TOKENS || 10000);
22
24
  const DEFAULT_AGENT_THREADS = Number(process.env.MYTE_CODY_AGENT_THREADS || 4);
25
+ const CLIENT_BASE_INSTRUCTIONS =
26
+ "You are MyteCody, a coding agent running through the Myte coding gateway.";
23
27
 
24
28
  function findEnvPath(startDir) {
25
29
  let cur = startDir;
@@ -214,6 +218,10 @@ Usage:
214
218
  mytecody update [--json] [--manifest <url-or-file>]
215
219
  mytecody help
216
220
 
221
+ Updates:
222
+ mytecody update updates the signed MyteCody engine only
223
+ npm install -g myte@latest updates this npm launcher and Myte API tools
224
+
217
225
  Network:
218
226
  The distributed MyteCody client uses the Myte AI gateway for coding
219
227
  inference. It can inspect local config without network, but coding requires
@@ -233,6 +241,7 @@ function commonStatus(args, envPath) {
233
241
  product: "MyteCody",
234
242
  command: "mytecody",
235
243
  package_version: PACKAGE_VERSION,
244
+ package: packageStatusBase(args),
236
245
  mode: "team-gateway",
237
246
  workspace: process.cwd(),
238
247
  env_file: envPath,
@@ -242,6 +251,16 @@ function commonStatus(args, envPath) {
242
251
  inference_base_url: codyInferenceBase(args),
243
252
  network_required_for_coding: true,
244
253
  },
254
+ instruction_pack: {
255
+ owner: "myte-cody-gateway",
256
+ client_embedded: false,
257
+ },
258
+ runtime: {
259
+ context_window: DEFAULT_CONTEXT_WINDOW,
260
+ auto_compact_tokens: DEFAULT_AUTO_COMPACT_TOKENS,
261
+ tool_output_tokens: DEFAULT_TOOL_OUTPUT_TOKENS,
262
+ max_concurrent_agent_threads: DEFAULT_AGENT_THREADS,
263
+ },
245
264
  release: {
246
265
  channel: String(args.channel || process.env.MYTE_CODY_RELEASE_CHANNEL || DEFAULT_CHANNEL),
247
266
  manifest_url: manifestUrl(args),
@@ -255,6 +274,103 @@ function commonStatus(args, envPath) {
255
274
  };
256
275
  }
257
276
 
277
+ function packageLatestUrl(args = {}) {
278
+ return String(
279
+ args["package-latest-url"] ||
280
+ process.env.MYTE_CODY_PACKAGE_LATEST_URL ||
281
+ process.env.MYTE_PACKAGE_LATEST_URL ||
282
+ DEFAULT_PACKAGE_LATEST_URL,
283
+ );
284
+ }
285
+
286
+ function packageUpdateCheckEnabled(args = {}) {
287
+ if (args["package-update-check"] === false) return false;
288
+ return process.env.MYTE_CODY_PACKAGE_UPDATE_CHECK !== "0";
289
+ }
290
+
291
+ function packageStatusBase(args = {}) {
292
+ return {
293
+ name: PACKAGE_NAME,
294
+ installed_version: PACKAGE_VERSION,
295
+ latest_version: null,
296
+ update_available: null,
297
+ check_status: "not-checked",
298
+ latest_url: packageLatestUrl(args),
299
+ update_command: `npm install -g ${PACKAGE_NAME}@latest`,
300
+ engine_update_command: "mytecody update",
301
+ };
302
+ }
303
+
304
+ function parseSemverish(version) {
305
+ const main = String(version || "")
306
+ .trim()
307
+ .replace(/^v/i, "")
308
+ .split(/[+-]/)[0];
309
+ const match = main.match(/^(\d+)(?:\.(\d+))?(?:\.(\d+))?/);
310
+ if (!match) return null;
311
+ return [match[1], match[2] || "0", match[3] || "0"].map((part) => Number(part));
312
+ }
313
+
314
+ function compareSemverish(left, right) {
315
+ const leftParts = parseSemverish(left);
316
+ const rightParts = parseSemverish(right);
317
+ if (!leftParts || !rightParts) return String(left || "").localeCompare(String(right || ""));
318
+ for (let i = 0; i < 3; i += 1) {
319
+ if (leftParts[i] > rightParts[i]) return 1;
320
+ if (leftParts[i] < rightParts[i]) return -1;
321
+ }
322
+ return 0;
323
+ }
324
+
325
+ function isVersionNewer(latest, installed = PACKAGE_VERSION) {
326
+ return compareSemverish(latest, installed) > 0;
327
+ }
328
+
329
+ function packageUpdateTimeoutMs() {
330
+ const value = Number(process.env.MYTE_CODY_PACKAGE_UPDATE_TIMEOUT_MS || 1500);
331
+ return Number.isFinite(value) && value > 0 ? value : 1500;
332
+ }
333
+
334
+ async function checkPackageUpdate(args = {}) {
335
+ const status = packageStatusBase(args);
336
+ if (!packageUpdateCheckEnabled(args)) {
337
+ return { ...status, check_status: "skipped" };
338
+ }
339
+ try {
340
+ const response = await fetchJson(status.latest_url, {
341
+ timeoutMs: packageUpdateTimeoutMs(),
342
+ });
343
+ if (!response.ok) {
344
+ return {
345
+ ...status,
346
+ check_status: "unavailable",
347
+ registry_status: response.status,
348
+ };
349
+ }
350
+ const latestVersion = response.body && response.body.version ? String(response.body.version) : "";
351
+ if (!latestVersion) {
352
+ return { ...status, check_status: "invalid-response" };
353
+ }
354
+ return {
355
+ ...status,
356
+ latest_version: latestVersion,
357
+ update_available: isVersionNewer(latestVersion, PACKAGE_VERSION),
358
+ check_status: "ok",
359
+ };
360
+ } catch (error) {
361
+ return {
362
+ ...status,
363
+ check_status: "unavailable",
364
+ error: error && error.message ? error.message : String(error),
365
+ };
366
+ }
367
+ }
368
+
369
+ function packageUpdateNotice(packageStatus) {
370
+ if (!packageStatus || packageStatus.update_available !== true) return "";
371
+ return `myte package update available: ${packageStatus.latest_version} (installed ${packageStatus.installed_version}). Run ${packageStatus.update_command}`;
372
+ }
373
+
258
374
  function printJson(payload) {
259
375
  console.log(JSON.stringify(payload, null, 2));
260
376
  }
@@ -601,26 +717,13 @@ function pathForToml(value) {
601
717
 
602
718
  function writeCodexModelCatalog() {
603
719
  fs.mkdirSync(codexHome(), { recursive: true });
604
- const baseInstructions = [
605
- "You are MyteCody, a coding agent running in the Myte terminal harness.",
606
- "",
607
- "You and the user share one local workspace. Start in the current repository and operate there by default. Inspect outside the current repository only when explicitly asked.",
608
- "",
609
- "Your job is to understand the user's intent, inspect the relevant files, run local commands when useful, edit files with the available patch tool, run focused verification, and stop when the task is actually handled.",
610
- "",
611
- "For documentation, architecture, and repo-summary work, verify each material claim independently before presenting it as implemented fact. Separate current implementation from planned direction and unknowns. Treat planning docs as intent unless source code, config, command output, or logs prove the behavior exists.",
612
- "",
613
- "For edits, prefer apply_patch. If a patch fails, read the error, inspect the target file again, and retry with a corrected patch. Do not claim completion until after inspecting the resulting file or relevant diff.",
614
- "",
615
- "Keep responses concise and factual. Do not invent commands, flags, telemetry names, tool behavior, context-window defaults, retrieval behavior, or implemented features.",
616
- ].join("\n");
617
720
  const catalog = {
618
721
  models: [
619
722
  {
620
723
  slug: DEFAULT_MODEL_ALIAS,
621
724
  display_name: "Myte",
622
725
  description: "Myte AI coding model.",
623
- base_instructions: baseInstructions,
726
+ base_instructions: CLIENT_BASE_INSTRUCTIONS,
624
727
  default_reasoning_level: "medium",
625
728
  supported_reasoning_levels: [
626
729
  { effort: "low", description: "Fast local coding pass." },
@@ -796,6 +899,14 @@ async function runCodex(rawArgs, args = {}, envPath = null) {
796
899
  return 1;
797
900
  }
798
901
 
902
+ let packageNotice = "";
903
+ try {
904
+ progress("checking myte package version");
905
+ packageNotice = packageUpdateNotice(await checkPackageUpdate(args));
906
+ } catch {
907
+ packageNotice = "";
908
+ }
909
+
799
910
  const command = resolveCodexCommand();
800
911
  if (!command) {
801
912
  await splash.stop();
@@ -812,6 +923,7 @@ async function runCodex(rawArgs, args = {}, envPath = null) {
812
923
  };
813
924
  progress("opening MyteCody workspace");
814
925
  await splash.stop();
926
+ if (packageNotice) statusLine(packageNotice);
815
927
  return new Promise((resolve) => {
816
928
  const child = spawn(command.cmd, launchArgs, {
817
929
  cwd: process.cwd(),
@@ -833,6 +945,7 @@ async function runDoctor(args, envPath) {
833
945
  ready_for_coding: false,
834
946
  ...commonStatus(args, envPath),
835
947
  };
948
+ payload.package = await checkPackageUpdate(args);
836
949
  if (args["probe-gateway"]) {
837
950
  payload.gateway.probe = await probeGateway(args);
838
951
  }
@@ -853,6 +966,17 @@ async function runDoctor(args, envPath) {
853
966
  if (payload.gateway.probe) {
854
967
  console.log(`gateway probe: ${payload.gateway.probe.ok ? "ok" : "failed"}`);
855
968
  }
969
+ console.log(`package: ${payload.package.installed_version}`);
970
+ if (payload.package.check_status === "ok" && payload.package.update_available) {
971
+ console.log(`package update: ${payload.package.latest_version} available`);
972
+ console.log(`package command: ${payload.package.update_command}`);
973
+ } else if (payload.package.check_status === "ok") {
974
+ console.log("package update: current");
975
+ } else if (payload.package.check_status === "skipped") {
976
+ console.log("package update: skipped");
977
+ } else {
978
+ console.log(`package update: ${payload.package.check_status}`);
979
+ }
856
980
  console.log(`client: ${payload.release.client_installed ? payload.release.client_version : "not installed"}`);
857
981
  console.log(`install: ${payload.release.install_root}`);
858
982
  console.log("");
@@ -981,6 +1105,7 @@ async function runUpdate(args, envPath) {
981
1105
  return 0;
982
1106
  }
983
1107
  console.log(dryRun ? "MYTE CODY update dry-run" : "MYTE CODY update");
1108
+ console.log("scope: MyteCody engine only");
984
1109
  console.log(`manifest: ${payload.manifest.source}`);
985
1110
  console.log(`manifest read: ${payload.manifest.read_status}`);
986
1111
  console.log(`platform: ${payload.release.platform}`);
@@ -996,6 +1121,7 @@ async function runUpdate(args, envPath) {
996
1121
  if (payload.installed) {
997
1122
  console.log(`installed: ${payload.installed.executable}`);
998
1123
  }
1124
+ console.log(`npm launcher/API tools: ${payload.package.update_command}`);
999
1125
  return 0;
1000
1126
  }
1001
1127
 
@@ -1034,6 +1160,7 @@ if (require.main === module) {
1034
1160
  }
1035
1161
 
1036
1162
  module.exports = {
1163
+ checkPackageUpdate,
1037
1164
  codexLaunchArgs,
1038
1165
  codexProviderArgs,
1039
1166
  codyInferenceBase,
@@ -1043,6 +1170,8 @@ module.exports = {
1043
1170
  ensureBrandedEngineInstalled,
1044
1171
  gatewayRoot,
1045
1172
  installedClientCommand,
1173
+ isVersionNewer,
1174
+ packageUpdateNotice,
1046
1175
  resolveCodexCommand,
1047
1176
  run,
1048
1177
  sha256Hex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mytegroupinc/myte-core",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "description": "Myte CLI core implementation.",
5
5
  "type": "commonjs",
6
6
  "main": "cli.js",