@swmansion/argent 0.34.1-next.84 → 0.34.1-next.86

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/cli-cmds.mjs CHANGED
@@ -36295,7 +36295,7 @@ function isCi(env = process.env) {
36295
36295
  var SESSION_ID2 = randomUUID5();
36296
36296
  function readCliVersion() {
36297
36297
  if (true) {
36298
- return "0.34.1-next.84";
36298
+ return "0.34.1-next.85";
36299
36299
  }
36300
36300
  return "0.0.0";
36301
36301
  }
@@ -16995,7 +16995,7 @@ function isCi(env = process.env) {
16995
16995
  var SESSION_ID = randomUUID4();
16996
16996
  function readCliVersion() {
16997
16997
  if (true) {
16998
- return "0.34.1-next.84";
16998
+ return "0.34.1-next.85";
16999
16999
  }
17000
17000
  return "0.0.0";
17001
17001
  }
@@ -207,6 +207,10 @@ export interface ArgentToolArgs {
207
207
  port?: number;
208
208
  /** Device id used with debugger-connect. For macOS, use the Mac app id. */
209
209
  device_id: string;
210
+ /** How many of the newest entries to return in `entries`. Default 20. */
211
+ tail?: number;
212
+ /** Return only these levels in `entries`, e.g. ["warning", "error"]. Stats and clusters stay unfiltered. */
213
+ levels?: Array<"log" | "debug" | "info" | "error" | "warning" | "dir" | "dirxml" | "table" | "trace" | "clear" | "startGroup" | "startGroupCollapsed" | "endGroup" | "assert" | "profile" | "profileEnd" | "count" | "timeEnd">;
210
214
  };
211
215
  "debugger-reload-metro": {
212
216
  /** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
@@ -25892,10 +25892,10 @@ var require_utf32 = __commonJS({
25892
25892
  var offset = 0;
25893
25893
  for (var i = 0; i < src.length; i += 2) {
25894
25894
  var code = src.readUInt16LE(i);
25895
- var isHighSurrogate = code >= 55296 && code < 56320;
25895
+ var isHighSurrogate2 = code >= 55296 && code < 56320;
25896
25896
  var isLowSurrogate = code >= 56320 && code < 57344;
25897
25897
  if (this.highSurrogate) {
25898
- if (isHighSurrogate || !isLowSurrogate) {
25898
+ if (isHighSurrogate2 || !isLowSurrogate) {
25899
25899
  write32.call(dst, this.highSurrogate, offset);
25900
25900
  offset += 4;
25901
25901
  } else {
@@ -25906,7 +25906,7 @@ var require_utf32 = __commonJS({
25906
25906
  continue;
25907
25907
  }
25908
25908
  }
25909
- if (isHighSurrogate) {
25909
+ if (isHighSurrogate2) {
25910
25910
  this.highSurrogate = code;
25911
25911
  } else {
25912
25912
  write32.call(dst, code, offset);
@@ -72947,7 +72947,7 @@ function isCi(env = process.env) {
72947
72947
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
72948
72948
  function readCliVersion() {
72949
72949
  if (true) {
72950
- return "0.34.1-next.84";
72950
+ return "0.34.1-next.85";
72951
72951
  }
72952
72952
  return "0.0.0";
72953
72953
  }
@@ -75113,14 +75113,12 @@ function startUpdateChecker() {
75113
75113
 
75114
75114
  // ../tool-server/src/update-utils.ts
75115
75115
  function buildUpdateNote(currentVersion, latestVersion) {
75116
- return `NOTE: An update for Argent is available (${currentVersion} -> ${latestVersion}).
75116
+ return `An Argent update is available (${currentVersion} -> ${latestVersion}). Briefly tell the user, then continue with their request.
75117
75117
 
75118
- IMPORTANT \u2014 Updates must only be applied with the user's explicit, informed consent. Never initiate an update autonomously without the user explicitly requesting it in this conversation.
75119
-
75120
- How to update:
75121
- - Manual (user-initiated): run \`npx @swmansion/argent update\` in the terminal
75122
- - Agent-assisted (requires explicit user consent): call the \`update-argent\` tool \u2014 only after the user has explicitly asked you to update Argent in this conversation
75123
- - To postpone it (later, tomorrow, stop, never): call the \`dismiss-update\` tool with the hours to wait, 87600 for never. That is the only thing that changes when this reminder appears; a memory or a reminder of your own does not
75118
+ Update only if the user asks you to in this conversation:
75119
+ - The user can run \`npx @swmansion/argent update\` in the terminal.
75120
+ - Or, once they ask, you can call the \`update-argent\` tool.
75121
+ - To postpone it (later, tomorrow, stop, never), call the \`dismiss-update\` tool with the hours to wait, 87600 for never. That is the only thing that changes when this reminder appears; a memory or a reminder of your own does not.
75124
75122
 
75125
75123
  This reminder comes from Argent itself. It will not repeat for the next 30 minutes and then repeats on its own, so it needs no task, memory entry or scheduled reminder.`;
75126
75124
  }
@@ -120315,6 +120313,8 @@ var MAX_ENTRIES = 5e4;
120315
120313
  var STALE_LOG_MS = 24 * 60 * 60 * 1e3;
120316
120314
  var CLUSTER_KEY_LENGTH = 80;
120317
120315
  var SOURCE_EXT = /\.(tsx?|jsx?|mjs|cjs)$/;
120316
+ var RECENT_PER_LEVEL = 100;
120317
+ var RECENT_MESSAGE_CHARS = 300;
120318
120318
  var LINE_RE = /^\[L:(\d+)\] (\S+) (\S+)\s+(\S+) \| (.*)$/;
120319
120319
  var CAMEL_LEVELS = ["startGroup", "startGroupCollapsed", "endGroup", "profileEnd", "timeEnd"];
120320
120320
  var liveLogFiles = /* @__PURE__ */ new Set();
@@ -120327,6 +120327,7 @@ var LogFileWriter = class {
120327
120327
  midLine = false;
120328
120328
  levelCounts = {};
120329
120329
  clusters = /* @__PURE__ */ new Map();
120330
+ recent = /* @__PURE__ */ new Map();
120330
120331
  ready = false;
120331
120332
  closed = false;
120332
120333
  constructor(port) {
@@ -120382,6 +120383,7 @@ ${line}` : line);
120382
120383
  }
120383
120384
  this.entryCount++;
120384
120385
  this.levelCounts[entry.level] = (this.levelCounts[entry.level] || 0) + 1;
120386
+ this.remember(entry);
120385
120387
  const key2 = entry.message.slice(0, CLUSTER_KEY_LENGTH);
120386
120388
  const existing = this.clusters.get(key2);
120387
120389
  if (existing) {
@@ -120400,6 +120402,23 @@ ${line}` : line);
120400
120402
  }
120401
120403
  return rich;
120402
120404
  }
120405
+ remember(entry) {
120406
+ const ring = this.recent.get(entry.level) ?? [];
120407
+ ring.push({
120408
+ id: entry.id,
120409
+ timestamp: entry.timestamp,
120410
+ level: entry.level,
120411
+ message: cutMessage(entry.message)
120412
+ });
120413
+ if (ring.length > RECENT_PER_LEVEL) ring.shift();
120414
+ this.recent.set(entry.level, ring);
120415
+ }
120416
+ /** The newest `limit` entries, oldest first. Exact only up to RECENT_PER_LEVEL. */
120417
+ getRecent(limit, levels) {
120418
+ const wanted = levels ? new Set(levels) : null;
120419
+ const pool = [...this.recent].filter(([level]) => !wanted || wanted.has(level)).flatMap(([, ring]) => ring);
120420
+ return pool.sort((a, b) => a.id - b.id).slice(-limit);
120421
+ }
120403
120422
  /** A torn line past " | " would parse as a whole entry with its message cut. */
120404
120423
  dropTornLine(fd, bytes, written) {
120405
120424
  try {
@@ -120520,6 +120539,18 @@ function cleanSourceUrl(url2) {
120520
120539
  return null;
120521
120540
  }
120522
120541
  }
120542
+ function cutMessage(message) {
120543
+ if (message.length <= RECENT_MESSAGE_CHARS) return message;
120544
+ let end = RECENT_MESSAGE_CHARS - 1;
120545
+ if (isHighSurrogate(message.charCodeAt(end - 1))) end--;
120546
+ return detachedCopy(message.slice(0, end)) + "\u2026";
120547
+ }
120548
+ function isHighSurrogate(code) {
120549
+ return code >= 55296 && code <= 56319;
120550
+ }
120551
+ function detachedCopy(text) {
120552
+ return Buffer.from(text, "utf16le").toString("utf16le");
120553
+ }
120523
120554
  function parseFlatLine(line) {
120524
120555
  const match = LINE_RE.exec(line);
120525
120556
  if (!match) return null;
@@ -139220,18 +139251,43 @@ Use when you need the source file and line for a component at a point. Convert f
139220
139251
 
139221
139252
  // ../tool-server/src/tools/debugger/debugger-log-registry.ts
139222
139253
  init_zod();
139254
+ var DEFAULT_TAIL = 20;
139255
+ var CONSOLE_LEVELS = [
139256
+ "log",
139257
+ "debug",
139258
+ "info",
139259
+ "error",
139260
+ "warning",
139261
+ "dir",
139262
+ "dirxml",
139263
+ "table",
139264
+ "trace",
139265
+ "clear",
139266
+ "startGroup",
139267
+ "startGroupCollapsed",
139268
+ "endGroup",
139269
+ "assert",
139270
+ "profile",
139271
+ "profileEnd",
139272
+ "count",
139273
+ "timeEnd"
139274
+ ];
139223
139275
  var zodSchema37 = external_exports.object({
139224
139276
  port: metroPortField,
139225
139277
  device_id: external_exports.string().describe(
139226
139278
  "Device id used with debugger-connect<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
139279
+ ),
139280
+ tail: external_exports.coerce.number().int().min(1).max(RECENT_PER_LEVEL).optional().describe("How many of the newest entries to return in `entries`. Default 20."),
139281
+ levels: external_exports.array(external_exports.enum(CONSOLE_LEVELS)).min(1).optional().describe(
139282
+ 'Return only these levels in `entries`, e.g. ["warning", "error"]. Stats and clusters stay unfiltered.'
139227
139283
  )
139228
139284
  });
139229
139285
  function createDebuggerLogRegistryTool(registry2) {
139230
139286
  return {
139231
139287
  id: "debugger-log-registry",
139232
- description: `Get a summary of all console logs captured from the app's JS runtime.
139288
+ description: `Get a summary of all console logs captured from the app's JS runtime, with the newest entries inline in { entries } (oldest first, messages cut to 300 characters).
139233
139289
  Returns the log file path, entry counts by level, and message clusters (grouped by similarity). Supports React Native<flag:macos-apps> (including Mac apps)</flag:macos-apps> and Chromium.
139234
- Use when investigating warnings, errors, or unexpected output. Call this first for an overview, then Grep the returned file for details; never Read it whole, it can hold 50,000 lines. Returns empty stats if no log data has been captured yet, but check { note }, which is present only when { file } does not exist or holds fewer entries than totalEntries counts (failed writes, e.g. a full disk), or when the stats are empty BECAUSE the previous debugger session ended: torn down (its log file deleted) or cut off by an app crash (the note names its kept log file, if it had one). Without that note, empty means the app has logged nothing.
139290
+ Use when investigating warnings, errors, or unexpected output. Read { entries } first; Grep the returned file only for older lines or full messages, and never Read it whole: capture stops at 50,000 lines per session. Returns empty stats if no log data has been captured yet, but check { note }, which is present only when { file } does not exist or holds fewer entries than totalEntries counts (failed writes, e.g. a full disk), or when the stats are empty BECAUSE the previous debugger session ended: torn down (its log file deleted) or cut off by an app crash (the note names its kept log file, if it had one). Without that note, empty means the app has logged nothing.
139235
139291
  When the debugger cannot be reached, it returns { status: "not_connected", reason, detail, guidance } with NO log file. Follow the guidance (do not retry in a loop). Grep a log file in this state only when a { note } names one kept from before the app crashed. A "connected" result's stats may come from a session whose socket has since died. Use debugger-status, not this tool, to judge debugger health.`,
139236
139292
  zodSchema: zodSchema37,
139237
139293
  readOnly: true,
@@ -139249,11 +139305,13 @@ When the debugger cannot be reached, it returns { status: "not_connected", reaso
139249
139305
  const api = await resolveDebuggerService(registry2, params);
139250
139306
  const stats = api.logWriter.getStats();
139251
139307
  const clusters = api.logWriter.getClusters(20);
139308
+ const entries = api.logWriter.getRecent(params.tail ?? DEFAULT_TAIL, params.levels);
139252
139309
  trackDebuggerOutcome("debugger-log-registry", "connected", params, ctx);
139253
139310
  const response = {
139254
139311
  status: "connected",
139255
139312
  ...stats,
139256
139313
  clusters,
139314
+ entries,
139257
139315
  deviceName: api.deviceName,
139258
139316
  appName: api.appName,
139259
139317
  logicalDeviceId: api.logicalDeviceId
@@ -139267,7 +139325,7 @@ When the debugger cannot be reached, it returns { status: "not_connected", reaso
139267
139325
  if (reaped2) response.note = describeReapedSession(reaped2, "JS-runtime debugger session");
139268
139326
  }
139269
139327
  const inFile = api.logWriter.getFileEntryCount();
139270
- const fileNote = !api.logWriter.hasFile() ? `No log file exists at ${stats.file}, so there is nothing to grep: the counts and clusters are all that was captured. Usually the disk was full or ~/.argent/tmp was not writable when this session started (if root owns ~/.argent: sudo chown -R "$USER" ~/.argent). Only a new debugger session gets a file: once that is fixed, call stop-all-simulator-servers with devices: ["${canonicalDeviceId(params.device_id)}"], then debugger-connect again.` : inFile === 0 && stats.totalEntries > 0 ? `The log file at ${stats.file} holds none of the ${stats.totalEntries} captured entries: every write to it failed (e.g. a full disk), so there is nothing to grep and the counts and clusters are all that was captured. Entries logged once the disk has room are written to it.` : inFile < stats.totalEntries ? `The log file at ${stats.file} holds only ${inFile} of the ${stats.totalEntries} captured entries: the other writes to it failed (e.g. a full disk or a file-size limit), so byLevel and clusters count entries that grepping it will not find. Entries logged once the disk has room are written to it.` : void 0;
139328
+ const fileNote = !api.logWriter.hasFile() ? `No log file exists at ${stats.file}, so there is nothing to grep: the counts, clusters and { entries } are all that was captured. Usually the disk was full or ~/.argent/tmp was not writable when this session started (if root owns ~/.argent: sudo chown -R "$USER" ~/.argent). Only a new debugger session gets a file: once that is fixed, call stop-all-simulator-servers with devices: ["${canonicalDeviceId(params.device_id)}"], then debugger-connect again.` : inFile === 0 && stats.totalEntries > 0 ? `The log file at ${stats.file} holds none of the ${stats.totalEntries} captured entries: every write to it failed (e.g. a full disk), so there is nothing to grep and the counts, clusters and { entries } are all that was captured. Entries logged once the disk has room are written to it.` : inFile < stats.totalEntries ? `The log file at ${stats.file} holds only ${inFile} of the ${stats.totalEntries} captured entries: the other writes to it failed (e.g. a full disk or a file-size limit), so byLevel and clusters count entries that grepping it will not find. Entries logged once the disk has room are written to it.` : void 0;
139271
139329
  if (fileNote) response.note = response.note ? `${response.note} ${fileNote}` : fileNote;
139272
139330
  return response;
139273
139331
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.84",
3
+ "version": "0.34.1-next.86",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
6
6
  "license": "Apache-2.0",
@@ -98,5 +98,5 @@
98
98
  "vitest": "^5.0.5",
99
99
  "yaml": "^2.9.1"
100
100
  },
101
- "gitHead": "e952ba7dc326a7f7ca21f385fc5a786335f75424"
101
+ "gitHead": "dbffce3735f3ed3380579ec3bd4589d951643612"
102
102
  }
@@ -24,7 +24,7 @@ Use the `device_id` from `list-devices` and keep the same ID and Metro port acro
24
24
  | `restart-app` | Relaunching the app when it lost its Metro connection |
25
25
  | `debugger-component-tree` | Component names and testIDs on screen. Find tap targets with `describe` |
26
26
  | `debugger-inspect-element` | Which component is at a point and where it is defined (source file:line). Takes **logical pixels**, not normalized 0–1 |
27
- | `debugger-log-registry` | Console log summary and the log file path (§4) |
27
+ | `debugger-log-registry` | Console log summary, the newest entries inline, and the log file path (§4) |
28
28
  | `debugger-evaluate` | Running a JS expression in the app runtime |
29
29
  | `view-network-logs` → `view-network-request-details` | Find a request and inspect its headers, timing, or body |
30
30
 
@@ -68,7 +68,7 @@ What the `guidance` does not tell you:
68
68
 
69
69
  ## 4. Reading Console Logs (Log Registry)
70
70
 
71
- Logs are written to a flat log file on disk. `debugger-log-registry` returns the summary and the file path.
71
+ `debugger-log-registry` returns the newest log entries inline (`levels` and `tail` filter them) plus the path of the full log file. Read `entries` first; search the file only for older lines or full messages.
72
72
 
73
73
  ### Flat log format
74
74
 
@@ -64,7 +64,7 @@ When a build fails (e.g. xcodebuild exit code 65), try the simplest fix first: c
64
64
 
65
65
  | Problem type | Where to look |
66
66
  | --------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
67
- | **JavaScript errors / logs** | `debugger-log-registry` for a summary and the log file path, then `Grep` the file |
67
+ | **JavaScript errors / logs** | `debugger-log-registry` for a summary and the newest entries, then `Grep` its log file for more |
68
68
  | **React component hierarchy** | `debugger-component-tree`, or `debugger-inspect-element` at logical pixel coordinates (not normalized 0-1) |
69
69
  | **App state** | `debugger-evaluate` to run JavaScript in the app's runtime |
70
70
  | **Native crashes / native stack** | iOS: `~/Library/Logs/DiagnosticReports/`. Android: `adb -s <serial> logcat -d`, with `-b crash` for crashes only |
@@ -44,7 +44,7 @@ See [references/semantic-checklist.md](references/semantic-checklist.md) for ful
44
44
 
45
45
  ### Phase 4: Verify no regressions
46
46
 
47
- Navigate every screen and UI flow within scope (the entire app if no scope was given, via `argent-device-interact`) and confirm each renders without errors. Check `debugger-log-registry` for warnings and errors (`Grep` its log file). Argent hides LogBox toasts once a `debugger-*` tool connects, so screenshots catch only full-screen red errors. Look for regressions the fixes introduced (e.g. fewer re-renders but higher CPU, or new jank on a different screen). Main agent only.
47
+ Navigate every screen and UI flow within scope (the entire app if no scope was given, via `argent-device-interact`) and confirm each renders without errors. Check `debugger-log-registry` for warnings and errors (`levels: ["warning", "error"]` with `tail: 100`). If the `byLevel` warning and error counts exceed the entries shown, `Grep` its log file for the rest. Argent hides LogBox toasts once a `debugger-*` tool connects, so screenshots catch only full-screen red errors. Look for regressions the fixes introduced (e.g. fewer re-renders but higher CPU, or new jank on a different screen). Main agent only.
48
48
 
49
49
  ## Startup time (TTI)
50
50