@dmsdc-ai/aigentry-telepty 0.1.84 → 0.1.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/AGENTS.md ADDED
@@ -0,0 +1,74 @@
1
+ # AGENTS.md — aigentry-telepty
2
+
3
+ ## Overview
4
+
5
+ PTY Multiplexer & Session Orchestrator — aigentry 에코시스템의 **통신 인프라**.
6
+ npm: `@dmsdc-ai/aigentry-telepty` | 멀티 AI 세션을 생성·연결·제어하는 PTY 멀티플렉서.
7
+
8
+ ## Architecture
9
+
10
+ ```
11
+ CLI (cli.js) ──→ HTTP/WS ──→ Daemon (daemon.js:3848)
12
+ ├── Session WS (/api/sessions/:id)
13
+ ├── Event Bus WS (/api/bus)
14
+ └── REST API (/api/sessions/*)
15
+ ```
16
+
17
+ | 파일 | 역할 |
18
+ |------|------|
19
+ | `cli.js` | CLI 명령 + allow-bridge (PTY 래핑) |
20
+ | `daemon.js` | HTTP/WS 서버, 세션 상태, inject 전달 |
21
+ | `tui.js` | blessed 기반 TUI 대시보드 |
22
+ | `session-routing.js` | 세션 ID 해석, alias 매칭, 호스트 그룹핑 |
23
+ | `daemon-control.js` | 싱글톤 daemon PID 관리 |
24
+ | `auth.js` | UUID 토큰 기반 인증 |
25
+ | `interactive-terminal.js` | raw mode stdin/stdout 관리 |
26
+ | `skill-installer.js` | CLI별 스킬 설치 (Claude/Codex/Gemini) |
27
+
28
+ ## Inject 전달 경로 (wrapped session)
29
+
30
+ 1. **Primary**: `kitty @ send-text` (터미널 직접 전달, allow-bridge 우회)
31
+ 2. **Fallback**: WS → allow-bridge → `child.write()` (PTY)
32
+ 3. **Submit**: `osascript` Return 키 → kitty fallback → WS `\r`
33
+
34
+ busy 세션: CR은 큐에 대기 중인 텍스트와 함께 큐잉 후 올바른 순서로 flush.
35
+
36
+ ## Commands
37
+
38
+ ```bash
39
+ npm test # 43 tests (node:test)
40
+ telepty daemon # daemon 시작 (포트 3848)
41
+ telepty allow --id <name> claude # 세션 래핑
42
+ telepty tui # TUI 대시보드
43
+ telepty list # 세션 목록
44
+ telepty inject <id> "msg" # 메시지 주입
45
+ telepty broadcast "msg" # 전체 브로드캐스트
46
+ telepty session start --launch # kitty 탭으로 다중 세션 시작
47
+ ```
48
+
49
+ ## Key Rules
50
+
51
+ - inject 후 submit은 항상 `osascript`로 통일 (`--no-enter` + osascript keystroke)
52
+ - inject 시 발신자 session ID (`--from`)를 항상 포함
53
+ - PTY `\r` 직접 의존 금지
54
+
55
+ ## Session Communication
56
+
57
+ ```bash
58
+ # List active sessions
59
+ telepty list
60
+
61
+ # Send message to another session
62
+ telepty inject --from aigentry-telepty-{cli} <target-session> "message"
63
+
64
+ # Report to orchestrator
65
+ telepty inject --ref --from aigentry-telepty-{cli} aigentry-orchestrator-claude "report"
66
+ ```
67
+
68
+ ## Work Principles
69
+
70
+ - **Best-First**: 항상 최선의 해결책 선택. 차선책/우회 금지.
71
+ - **Configurable**: 설정으로 제어 가능한 구조. 하드코딩 금지.
72
+ - **Evidence-Based**: 추측 금지. 데이터/로그/테스트 결과 기반 판단.
73
+ - **Fail Fast**: 에러 즉시 보고. 숨기지 않음.
74
+ - **Constitution**: ~/projects/aigentry/docs/CONSTITUTION.md 준수.
package/GEMINI.md ADDED
@@ -0,0 +1,10 @@
1
+ @AGENTS.md
2
+
3
+ # Gemini CLI — aigentry-telepty
4
+
5
+ ## Gemini 전용 설정
6
+
7
+ - 세션 ID: `aigentry-telepty-gemini`
8
+ - 보고: `telepty inject --ref --from aigentry-telepty-gemini aigentry-orchestrator-claude "보고 내용"`
9
+ - Gemini 강점 활용: upstream 이슈 검색, API 리서치, 문서화 우선
10
+ - 헌법: `~/projects/aigentry/docs/CONSTITUTION.md`
package/daemon.js CHANGED
@@ -445,7 +445,8 @@ async function writeDataToSession(id, session, data) {
445
445
  // UDS delivery via net.connect()
446
446
  if (session.delivery && session.delivery.transport === 'unix_socket' && session.delivery.address) {
447
447
  return new Promise((resolve) => {
448
- const payload = JSON.stringify({ text: data, session_id: id }) + '\n';
448
+ const payload = JSON.stringify({ action: "Inject", workspace: id, text: data }) + '\n';
449
+ let responseBuf = '';
449
450
  const timeout = setTimeout(() => {
450
451
  sock.destroy();
451
452
  resolve(buildErrorBody('TIMEOUT', 'UDS delivery timed out.', { httpStatus: 504 }));
@@ -453,9 +454,23 @@ async function writeDataToSession(id, session, data) {
453
454
  const sock = net.connect(session.delivery.address, () => {
454
455
  sock.end(payload);
455
456
  });
456
- sock.on('data', () => {}); // drain
457
+ sock.on('data', (chunk) => { responseBuf += chunk.toString(); });
457
458
  sock.on('end', () => {
458
459
  clearTimeout(timeout);
460
+ if (responseBuf) {
461
+ try {
462
+ const resp = JSON.parse(responseBuf.trim());
463
+ if (resp.status === 'Error' || resp.success === false) {
464
+ resolve(buildErrorBody('DELIVERY_REJECTED', resp.error || resp.message || 'Target rejected the payload.', {
465
+ httpStatus: 502,
466
+ detail: resp
467
+ }));
468
+ return;
469
+ }
470
+ } catch {
471
+ // Non-JSON response — treat as success (legacy endpoints)
472
+ }
473
+ }
459
474
  resolve({ success: true });
460
475
  });
461
476
  sock.on('error', (err) => {
@@ -528,7 +543,7 @@ async function deliverInjectionToSession(id, session, prompt, options = {}) {
528
543
  return textResult;
529
544
  }
530
545
 
531
- if (!options.noEnter) {
546
+ if (!options.noEnter && session.type !== 'aterm') {
532
547
  const submitDelay = session.type === 'wrapped' ? 500 : 300;
533
548
  setTimeout(async () => {
534
549
  const submitResult = await writeDataToSession(id, session, '\r');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.1.84",
3
+ "version": "0.1.86",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "aigentry-telepty": "install.js",