agentlas 1.0.21 → 1.0.23

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.
@@ -1,52 +0,0 @@
1
- "use strict";
2
- /*
3
- * open — 기존 대화 재개: agentlas open <chat-id-prefix>
4
- * 해당 챗의 에이전트로 REPL을 열고 같은 chatId에 이어 쓴다
5
- * (CLI resume 세션도 chat_runtime_sessions에서 fingerprint 일치 시 복원).
6
- */
7
- const { rowToAgent, isPrivateWebOnlyAgentRow } = require("../agents/registry.cjs");
8
-
9
- function run(ctx, args) {
10
- const ko = ctx.lang === "ko";
11
- const prefix = String(args[0] || "").trim();
12
- if (!prefix) {
13
- ctx.err(ko ? "사용법: agentlas open <chat-id 앞부분> (agentlas chats 로 목록)" : "Usage: agentlas open <chat-id-prefix> (list with: agentlas chats)");
14
- return 1;
15
- }
16
- const db = ctx.db();
17
- // 사용자 표면은 kind='user' 챗만 연다 — 데스크탑 사용자 챗 목록과 동일 필터
18
- // (electron/store/chats.ts:86; 레거시 NULL=user 취급은 electron/store/db.ts:717).
19
- // 숨김 division 세션(자동화/본부 인프라)은 접두사를 알아도 재개 대상이 아니다.
20
- const rows = db.prepare(
21
- "SELECT c.id, c.title, c.agent_id FROM chats c WHERE c.id LIKE ? AND c.archived_at IS NULL AND (c.kind IS NULL OR c.kind = 'user') ORDER BY c.updated_at DESC LIMIT 2",
22
- ).all(prefix + "%");
23
- if (!rows.length) {
24
- ctx.err((ko ? "대화를 찾을 수 없음: " : "chat not found: ") + prefix);
25
- return 1;
26
- }
27
- if (rows.length > 1) {
28
- // 안내 접두사는 사용자가 입력한 것보다 반드시 길어야 한다 — chats 목록이
29
- // 8자를 찍으므로, 8자로 고정하면 8자 충돌 시 같은 문자열 두 개를 돌려주는
30
- // 막다른 길이 된다("더 긴 접두사"를 만들 방법이 없음).
31
- const hintLen = Math.max(8, prefix.length + 4);
32
- ctx.err(ko ? `모호합니다 — 더 긴 접두사를 쓰세요 (${rows.map((r) => r.id.slice(0, hintLen)).join(", ")})` : `Ambiguous — use a longer prefix (${rows.map((r) => r.id.slice(0, hintLen)).join(", ")})`);
33
- return 1;
34
- }
35
- const chat = rows[0];
36
- const agentRow = db.prepare("SELECT * FROM installed_agents WHERE id=?").get(chat.agent_id);
37
- if (!agentRow) {
38
- ctx.err(ko ? "이 대화의 에이전트가 더 이상 없습니다." : "The agent for this chat no longer exists.");
39
- return 1;
40
- }
41
- // registry 정책과 동일: 웹 전용(private) 에이전트는 챗 id를 알아도 터미널에서
42
- // 실행되면 안 된다 (hub/install.cjs 설치 게이트와 같은 문구).
43
- if (isPrivateWebOnlyAgentRow(agentRow)) {
44
- ctx.err("This web-only agent is not available in the Agentlas terminal.");
45
- return 1;
46
- }
47
- const { startRepl } = require("../ui/repl.cjs");
48
- ctx.out(ctx.ui.dim(`${ko ? "재개" : "resume"}: ${chat.title}`));
49
- return startRepl(ctx, { agent: rowToAgent(agentRow).slug, chatId: chat.id });
50
- }
51
-
52
- module.exports = { run };