@dmsdc-ai/aterm-darwin-arm64 0.1.58 → 0.1.59

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.
Binary file
@@ -365,7 +365,8 @@ if sock:
365
365
  sessions.append(ws)
366
366
  except: pass
367
367
 
368
- # 2. telepty external sessions (only if installed)
368
+ # 2. telepty external sessions (only if installed, deduplicated)
369
+ aterm_names = set(s.get("name", "") for s in sessions)
369
370
  try:
370
371
  result = subprocess.run(["telepty", "list", "--json"], capture_output=True, text=True, timeout=5)
371
372
  if result.returncode == 0:
@@ -373,6 +374,8 @@ try:
373
374
  for ts in (tdata if isinstance(tdata, list) else tdata.get("sessions", [])):
374
375
  ts.setdefault("terminal", ts.get("terminal", "external"))
375
376
  ts.setdefault("name", ts.get("id", "?"))
377
+ if ts.get("name", "") in aterm_names:
378
+ continue
376
379
  sessions.append(ts)
377
380
  except (FileNotFoundError, subprocess.TimeoutExpired, json.JSONDecodeError): pass
378
381
 
@@ -413,13 +416,16 @@ if sock:
413
416
  sessions.append((name, cli, cwd, "aterm"))
414
417
  except: pass
415
418
 
416
- # 2. telepty external sessions (only if installed)
419
+ # 2. telepty external sessions (only if installed, deduplicated)
420
+ aterm_names = set(r[0] for r in sessions)
417
421
  try:
418
422
  result = subprocess.run(["telepty", "list", "--json"], capture_output=True, text=True, timeout=5)
419
423
  if result.returncode == 0:
420
424
  tdata = json.loads(result.stdout)
421
425
  for ts in (tdata if isinstance(tdata, list) else tdata.get("sessions", [])):
422
426
  name = ts.get("name") or ts.get("id", "?")
427
+ if name in aterm_names:
428
+ continue
423
429
  cli = ts.get("cli", "")
424
430
  cwd = ts.get("cwd", "")
425
431
  terminal = ts.get("terminal", "external")
@@ -445,19 +451,96 @@ else:
445
451
  '
446
452
  fi ;;
447
453
  inject)
448
- if [ -z "$ATERM_IPC_SOCKET" ]; then exec telepty inject "${@:2}"; fi
454
+ shift
449
455
  _force_flag=false
456
+ _no_report=false
457
+ _ref_flag=false
458
+ _from_sender=""
450
459
  _inject_args=()
451
- for _arg in "${@:2}"; do
452
- if [ "$_arg" = "--force" ]; then _force_flag=true
453
- else _inject_args+=("$_arg"); fi
460
+ while [ "$#" -gt 0 ]; do
461
+ case "$1" in
462
+ --force) _force_flag=true; shift ;;
463
+ --no-report) _no_report=true; shift ;;
464
+ --ref) _ref_flag=true; shift ;;
465
+ --from) _from_sender="${2:-}"; shift 2 ;;
466
+ *) _inject_args+=("$1"); shift ;;
467
+ esac
454
468
  done
455
- [ ${#_inject_args[@]} -lt 2 ] && { echo '{"error":"usage: aterm inject <workspace> <text> [--force]"}' >&2; exit 1; }
456
- if [ "$_force_flag" = "true" ]; then
457
- aterm_ipc inject-force "${_inject_args[@]}"
458
- else
459
- aterm_ipc inject "${_inject_args[@]}"
460
- fi ;;
469
+ [ ${#_inject_args[@]} -lt 2 ] && { echo '{"error":"usage: aterm inject [--from <sender>] [--ref] [--no-report] [--force] <workspace> <text>"}' >&2; exit 1; }
470
+ python3 -c '
471
+ import json, sys, os, hashlib, socket
472
+
473
+ force = sys.argv[1] == "true"
474
+ no_report = sys.argv[2] == "true"
475
+ ref_flag = sys.argv[3] == "true"
476
+ from_sender = sys.argv[4]
477
+ ipc_socket = sys.argv[5]
478
+ remaining = sys.argv[6:]
479
+
480
+ workspace = remaining[0]
481
+ msg = " ".join(remaining[1:])
482
+
483
+ # Read inject config
484
+ inject_cfg = {}
485
+ cfg_path = os.path.expanduser("~/.aigentry/config/aterm.json")
486
+ if os.path.isfile(cfg_path):
487
+ try:
488
+ with open(cfg_path) as f:
489
+ inject_cfg = json.load(f).get("inject", {})
490
+ except: pass
491
+
492
+ mandatory_report = inject_cfg.get("mandatory_report", True)
493
+ auto_ref_threshold = inject_cfg.get("auto_ref_threshold", 500)
494
+
495
+ # Append mandatory report instruction
496
+ if from_sender and mandatory_report and not no_report:
497
+ msg += "\n\n\u26a0\ufe0f MANDATORY: When done, you MUST immediately run: aterm inject " + from_sender + " \x27REPORT: {modified files} | {change summary} | {build result} | {remaining issues}\x27. Do NOT idle or wait \u2014 report is REQUIRED before any other action."
498
+
499
+ # Auto-ref for long messages
500
+ if ref_flag or len(msg) > auto_ref_threshold:
501
+ ref_dir = os.path.expanduser("~/.aterm/refs")
502
+ os.makedirs(ref_dir, exist_ok=True)
503
+ h = hashlib.sha256(msg.encode()).hexdigest()
504
+ ref_path = os.path.join(ref_dir, h + ".md")
505
+ with open(ref_path, "w") as f:
506
+ f.write(msg)
507
+ msg = "[context-ref] Read " + ref_path + " and use it as the source of truth for this task."
508
+
509
+ # Dispatch
510
+ if not ipc_socket:
511
+ cmd = ["telepty", "inject"]
512
+ if from_sender:
513
+ cmd += ["--from", from_sender]
514
+ cmd += [workspace, msg]
515
+ os.execvp("telepty", cmd)
516
+ else:
517
+ payload = {"action": "Inject", "workspace": workspace, "text": msg, "from": os.environ.get("ATERM_WORKSPACE_NAME")}
518
+ if force:
519
+ payload["force"] = True
520
+ sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
521
+ try:
522
+ sock.settimeout(5)
523
+ sock.connect(ipc_socket)
524
+ sock.sendall((json.dumps(payload) + "\n").encode())
525
+ sock.shutdown(socket.SHUT_WR)
526
+ data = b""
527
+ while True:
528
+ chunk = sock.recv(4096)
529
+ if not chunk: break
530
+ data += chunk
531
+ if b"\n" in data: break
532
+ resp = json.loads(data.decode().strip().split("\n")[0])
533
+ if resp.get("status") == "Error":
534
+ print(json.dumps({"error": resp["message"]}), file=sys.stderr)
535
+ sys.exit(1)
536
+ else:
537
+ print(json.dumps({"status": "ok"}))
538
+ except Exception as e:
539
+ print(json.dumps({"error": str(e)}), file=sys.stderr)
540
+ sys.exit(1)
541
+ finally:
542
+ sock.close()
543
+ ' "$_force_flag" "$_no_report" "$_ref_flag" "$_from_sender" "${ATERM_IPC_SOCKET:-}" "${_inject_args[@]}" ;;
461
544
  status)
462
545
  if [ "$#" -eq 1 ]; then
463
546
  print_ecosystem_status
@@ -6,7 +6,7 @@
6
6
  <dict>
7
7
  <key>Resources/bin/aterm</key>
8
8
  <data>
9
- JLY7c+Sc374KBcuKBzvkRcGJq08=
9
+ P/uIgNhm9toASMimI4RR0juDghA=
10
10
  </data>
11
11
  </dict>
12
12
  <key>files2</key>
@@ -15,16 +15,16 @@
15
15
  <dict>
16
16
  <key>cdhash</key>
17
17
  <data>
18
- DmiwEicLH+10dGphCI1TyKZ7Z1U=
18
+ Sey+kIzbOnElCcNjq82gqWDjjV0=
19
19
  </data>
20
20
  <key>requirement</key>
21
- <string>cdhash H"0e68b012270b1fed74746a61088d53c8a67b6755"</string>
21
+ <string>cdhash H"49ecbe908cdb3a712509c363abcda0a960e38d5d"</string>
22
22
  </dict>
23
23
  <key>Resources/bin/aterm</key>
24
24
  <dict>
25
25
  <key>hash2</key>
26
26
  <data>
27
- If4LFiLeJX+JDDWTyW26tv/qQtvI6PlqpTgQDw49vLI=
27
+ s5bUwTZCPnhDBHD2yJTrPYbiUW/tvS95Jp51csx2xCg=
28
28
  </data>
29
29
  </dict>
30
30
  </dict>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aterm-darwin-arm64",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "darwin-arm64 native bundle for @dmsdc-ai/aterm",
5
5
  "type": "module",
6
6
  "files": [