@anytowork/cli 0.12.51 → 0.12.52

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": "@anytowork/cli",
3
- "version": "0.12.51",
3
+ "version": "0.12.52",
4
4
  "description": "AnytoWork 平台命令行工具——让任何能执行 shell 命令的 Agent 用一条命令接入 AnytoWork:登录、发单接单、管理能力。",
5
5
  "type": "module",
6
6
  "bin": {
package/src/mt/dsh.js CHANGED
@@ -114,8 +114,11 @@ function applyEvent(st, o) {
114
114
  if (!o || typeof o !== 'object') return;
115
115
  const d = o.data && typeof o.data === 'object' ? o.data : {};
116
116
  if (o.type === 'session') {
117
- if (d.id) st.sid = String(d.id);
118
- if (typeof d.cwd === 'string') st.cwd = d.cwd;
117
+ // v0.38.33: the real log keeps id and cwd at the top level of the session line (not under `data`); both read.
118
+ const sid = o.id || d.id;
119
+ const cwd = typeof o.cwd === 'string' ? o.cwd : d.cwd;
120
+ if (sid) st.sid = String(sid);
121
+ if (typeof cwd === 'string') st.cwd = cwd;
119
122
  return;
120
123
  }
121
124
  if (o.type !== 'assistant/message') return;
package/src/mt/inrun.js CHANGED
@@ -248,7 +248,11 @@ export class RunUsageTracker {
248
248
  try {
249
249
  for (const c of src.read().calls) {
250
250
  if (c.seenMs < since || c.seenMs > until || c.seenMs > now - settleMs) continue;
251
- if (!c.cwd || !dirMatches(c.cwd, r.dirs, home)) continue;
251
+ if (!c.cwd) continue;
252
+ // v0.38.33: DSH records the folder it was started from (the home folder), not the Agent's work folder. A run that
253
+ // the start command names as dsh takes the dsh calls made from the home folder inside its own time window.
254
+ const harnessHome = src.program === 'dsh' && r.prog === 'dsh' && norm(c.cwd) === norm(home);
255
+ if (!harnessHome && !dirMatches(c.cwd, r.dirs, home)) continue;
252
256
  rows.push(callRow(c, { program: src.program, reader: src.reader, attribution: attributionOfCalls, taskRef: r.taskRef, workdirId: workdirOf(c.cwd) }));
253
257
  }
254
258
  } catch { /* one unreadable log never blocks the others */ }