letagents 0.12.8 â 0.12.10
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/README.md +16 -15
- package/dist/mcp/agent-prompt-delivery.js +20 -0
- package/dist/mcp/codex-session/app-server.js +89 -0
- package/dist/mcp/codex-session/index.js +10 -0
- package/dist/mcp/codex-session/rpc-client.js +85 -0
- package/dist/mcp/codex-session/runtime-bridge.js +254 -0
- package/dist/mcp/codex-session/runtime-summary.js +220 -0
- package/dist/mcp/codex-session/session-inspection.js +100 -0
- package/dist/mcp/codex-session/session-mapper.js +51 -0
- package/dist/mcp/codex-session/session-start.js +182 -0
- package/dist/mcp/codex-session/session-status.js +77 -0
- package/dist/mcp/codex-session/session-stop.js +43 -0
- package/dist/mcp/codex-session/session-supervisor.js +111 -0
- package/dist/mcp/codex-session/start-prompt.js +49 -0
- package/dist/mcp/codex-session/types.js +1 -0
- package/dist/mcp/codex-session.js +1 -500
- package/dist/mcp/config-reader.js +10 -2
- package/dist/mcp/git-remote.js +90 -14
- package/dist/mcp/local-state/agent-identity.js +26 -0
- package/dist/mcp/local-state/agent-sessions.js +66 -0
- package/dist/mcp/local-state/auth.js +57 -0
- package/dist/mcp/local-state/codex-live-sessions.js +59 -0
- package/dist/mcp/local-state/index.js +8 -0
- package/dist/mcp/local-state/local-chat.js +808 -0
- package/dist/mcp/local-state/room-sessions.js +51 -0
- package/dist/mcp/local-state/storage.js +95 -0
- package/dist/mcp/local-state/types.js +1 -0
- package/dist/mcp/local-state.js +1 -286
- package/dist/mcp/managed-agent-providers.js +65 -0
- package/dist/mcp/rental-tools/activity.js +37 -0
- package/dist/mcp/rental-tools/budget.js +36 -0
- package/dist/mcp/rental-tools/context.js +62 -0
- package/dist/mcp/rental-tools/lifecycle.js +47 -0
- package/dist/mcp/rental-tools/metering.js +73 -0
- package/dist/mcp/rental-tools/patches.js +100 -0
- package/dist/mcp/rental-tools/provider.js +117 -0
- package/dist/mcp/rental-tools/shared.js +19 -0
- package/dist/mcp/rental-tools/types.js +1 -0
- package/dist/mcp/rental-tools.js +7 -0
- package/dist/mcp/repo-visibility.js +8 -6
- package/dist/mcp/server/register-tools.js +19 -0
- package/dist/mcp/server/repo-context.js +28 -0
- package/dist/mcp/server/resources.js +77 -0
- package/dist/mcp/server/runtime/agent-sessions.js +134 -0
- package/dist/mcp/server/runtime/api.js +82 -0
- package/dist/mcp/server/runtime/auth-cache.js +20 -0
- package/dist/mcp/server/runtime/device-auth.js +48 -0
- package/dist/mcp/server/runtime/identity/config.js +58 -0
- package/dist/mcp/server/runtime/identity/directory.js +87 -0
- package/dist/mcp/server/runtime/identity/liveness.js +32 -0
- package/dist/mcp/server/runtime/identity/names.js +74 -0
- package/dist/mcp/server/runtime/identity/public.js +19 -0
- package/dist/mcp/server/runtime/identity/state.js +32 -0
- package/dist/mcp/server/runtime/identity.js +96 -0
- package/dist/mcp/server/runtime/messages.js +160 -0
- package/dist/mcp/server/runtime/presence.js +52 -0
- package/dist/mcp/server/runtime/room-api.js +42 -0
- package/dist/mcp/server/runtime/room-state.js +122 -0
- package/dist/mcp/server/runtime/rooms.js +318 -0
- package/dist/mcp/server/runtime.js +14 -0
- package/dist/mcp/server/tools/agent-sessions.js +374 -0
- package/dist/mcp/server/tools/messages/index.js +14 -0
- package/dist/mcp/server/tools/messages/read-tool.js +176 -0
- package/dist/mcp/server/tools/messages/reasoning-tool.js +179 -0
- package/dist/mcp/server/tools/messages/response.js +17 -0
- package/dist/mcp/server/tools/messages/send-tool.js +203 -0
- package/dist/mcp/server/tools/messages/status-tool.js +87 -0
- package/dist/mcp/server/tools/messages/wait-tool.js +333 -0
- package/dist/mcp/server/tools/messages.js +1 -0
- package/dist/mcp/server/tools/onboarding/device-auth-tools.js +148 -0
- package/dist/mcp/server/tools/onboarding/name-tool.js +89 -0
- package/dist/mcp/server/tools/onboarding/responses.js +10 -0
- package/dist/mcp/server/tools/onboarding/status-tool.js +108 -0
- package/dist/mcp/server/tools/onboarding.js +8 -0
- package/dist/mcp/server/tools/rental/activity-tools.js +43 -0
- package/dist/mcp/server/tools/rental/context-tools.js +35 -0
- package/dist/mcp/server/tools/rental/index.js +17 -0
- package/dist/mcp/server/tools/rental/metering-tools.js +39 -0
- package/dist/mcp/server/tools/rental/patch-tools.js +53 -0
- package/dist/mcp/server/tools/rental/provider-tools.js +44 -0
- package/dist/mcp/server/tools/rental/response.js +10 -0
- package/dist/mcp/server/tools/rental/types.js +1 -0
- package/dist/mcp/server/tools/rental.js +1 -0
- package/dist/mcp/server/tools/rooms/index.js +5 -0
- package/dist/mcp/server/tools/rooms/inspection-tools.js +124 -0
- package/dist/mcp/server/tools/rooms/join-tools.js +37 -0
- package/dist/mcp/server/tools/rooms/repo-initialization-tool.js +113 -0
- package/dist/mcp/server/tools/rooms/repo-visibility-tool.js +20 -0
- package/dist/mcp/server/tools/rooms/response.js +10 -0
- package/dist/mcp/server/tools/rooms/resume-tool.js +48 -0
- package/dist/mcp/server/tools/rooms.js +1 -0
- package/dist/mcp/server/tools/tasks/api.js +222 -0
- package/dist/mcp/server/tools/tasks/artifact-tools.js +75 -0
- package/dist/mcp/server/tools/tasks/board-intent-tools.js +321 -0
- package/dist/mcp/server/tools/tasks/board-tools.js +73 -0
- package/dist/mcp/server/tools/tasks/context.js +35 -0
- package/dist/mcp/server/tools/tasks/event-tools.js +40 -0
- package/dist/mcp/server/tools/tasks/index.js +14 -0
- package/dist/mcp/server/tools/tasks/lease-tools.js +145 -0
- package/dist/mcp/server/tools/tasks/mutation-tools.js +121 -0
- package/dist/mcp/server/tools/tasks/response.js +13 -0
- package/dist/mcp/server/tools/tasks/schemas.js +68 -0
- package/dist/mcp/server/tools/tasks.js +1 -0
- package/dist/mcp/server.js +10 -2540
- package/dist/mcp/sse-client.js +22 -16
- package/dist/shared/activation-routing.js +263 -0
- package/dist/shared/agent-identity.js +21 -5
- package/dist/shared/agent-presence.js +24 -0
- package/dist/shared/handoff.js +145 -0
- package/dist/shared/rental/lrt.js +214 -0
- package/dist/shared/rental/meter-types.js +14 -0
- package/dist/shared/request-headers.js +3 -0
- package/dist/shared/room-agent-activity.js +41 -0
- package/dist/shared/room-agent-prompts.js +14 -1
- package/package.json +15 -5
- /package/dist/{mcp â shared}/codenames.js +0 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { getRoomFromConfig } from "../../config-reader.js";
|
|
2
|
+
import { buildActiveGitRoomContext, getGitCurrentBranch, getGitDefaultBranch, getGitRoomContext, } from "../../git-remote.js";
|
|
3
|
+
import { encodeRoomIdPath, looksLikeInviteCode, normalizeInviteCode, } from "../../room-id.js";
|
|
4
|
+
import { isLocalRoomStorageEnabled, getStoredCurrentRoom, getStoredRoomSession, } from "../../local-state.js";
|
|
5
|
+
import { getDefaultManagedAgentProvider, toManagedAgentStartResponse, } from "../../managed-agent-providers.js";
|
|
6
|
+
import { ApiError, apiCall, isMissingRouteError, } from "./api.js";
|
|
7
|
+
import { RepoRoomAuthRequiredError, maybeHandleRepoRoomAuthRequired, } from "./device-auth.js";
|
|
8
|
+
import { ensureAgentIdentity, toPublicAgentIdentity, withAgentIdentity, } from "./identity.js";
|
|
9
|
+
import { withJoinRoomAgentPrompt } from "./messages.js";
|
|
10
|
+
import { syncRoomPresence } from "./presence.js";
|
|
11
|
+
import { rememberRoom, toPublicRoomResponse, toRoomState, } from "./room-state.js";
|
|
12
|
+
export function normalizeJoinSessionMode(value) {
|
|
13
|
+
return String(value || "").trim().toLowerCase() === "live" ? "live" : "current";
|
|
14
|
+
}
|
|
15
|
+
export function getCurrentLiveSessionPayload(roomId) {
|
|
16
|
+
return getDefaultManagedAgentProvider().getCurrentLiveSessionPayload(roomId);
|
|
17
|
+
}
|
|
18
|
+
function isNotFoundApiError(error) {
|
|
19
|
+
return error instanceof ApiError && error.status === 404;
|
|
20
|
+
}
|
|
21
|
+
function parseGeneratedGitRefRoomIdentifier(identifier) {
|
|
22
|
+
const match = /^git-room:github\.com:([^/:\s]+\/[^/:\s]+):(branch|tag):[A-Za-z0-9_-]+$/.exec(identifier.trim());
|
|
23
|
+
if (!match) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
repoRoom: `github.com/${match[1].toLowerCase()}`,
|
|
28
|
+
refType: match[2],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export async function joinRoomIdentifier(identifier, joinedVia, options = {}) {
|
|
32
|
+
const roomId = joinedVia === "join_code" ? normalizeInviteCode(identifier) : identifier.trim();
|
|
33
|
+
if (joinedVia !== "join_code" && await isLocalRoomStorageEnabled(roomId)) {
|
|
34
|
+
if (options.allowCreate === false && !getStoredRoomSession(roomId)) {
|
|
35
|
+
throw new ApiError(404, JSON.stringify({ error: "Room not found", room_id: roomId }));
|
|
36
|
+
}
|
|
37
|
+
const agentIdentity = await ensureAgentIdentity();
|
|
38
|
+
const room = rememberRoom(toRoomState({
|
|
39
|
+
room_id: roomId,
|
|
40
|
+
project_id: null,
|
|
41
|
+
code: null,
|
|
42
|
+
display_name: roomId,
|
|
43
|
+
joined_via: joinedVia,
|
|
44
|
+
is_local: true,
|
|
45
|
+
}));
|
|
46
|
+
return {
|
|
47
|
+
room,
|
|
48
|
+
response: {
|
|
49
|
+
room_id: roomId,
|
|
50
|
+
display_name: roomId,
|
|
51
|
+
joined_via: joinedVia,
|
|
52
|
+
is_local: true,
|
|
53
|
+
agent_identity: toPublicAgentIdentity(agentIdentity),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const createQuery = options.allowCreate === false ? "?create=false" : "";
|
|
59
|
+
const response = await apiCall(`/rooms/${encodeRoomIdPath(roomId)}/join${createQuery}`, { method: "POST" });
|
|
60
|
+
const joinedRoomId = typeof response.room_id === "string"
|
|
61
|
+
? response.room_id
|
|
62
|
+
: roomId;
|
|
63
|
+
const agentIdentity = await ensureAgentIdentity();
|
|
64
|
+
const room = rememberRoom(toRoomState({
|
|
65
|
+
room_id: joinedRoomId,
|
|
66
|
+
project_id: typeof response.project_id === "string" ? response.project_id : null,
|
|
67
|
+
code: typeof response.code === "string"
|
|
68
|
+
? response.code
|
|
69
|
+
: looksLikeInviteCode(joinedRoomId)
|
|
70
|
+
? joinedRoomId
|
|
71
|
+
: null,
|
|
72
|
+
display_name: typeof response.display_name === "string" ? response.display_name : null,
|
|
73
|
+
git_room: response.git_room ?? null,
|
|
74
|
+
joined_via: joinedVia,
|
|
75
|
+
}));
|
|
76
|
+
await syncRoomPresence(room.room_id, agentIdentity, {
|
|
77
|
+
status: "idle",
|
|
78
|
+
status_text: "available in room",
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
room,
|
|
82
|
+
response: {
|
|
83
|
+
...response,
|
|
84
|
+
room_id: joinedRoomId,
|
|
85
|
+
agent_identity: toPublicAgentIdentity(agentIdentity),
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
await maybeHandleRepoRoomAuthRequired(error, roomId);
|
|
91
|
+
if (options.allowCreate === false) {
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
if (!isMissingRouteError(error)) {
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (joinedVia === "join_code") {
|
|
99
|
+
const project = await apiCall(`/projects/join/${encodeURIComponent(roomId)}`);
|
|
100
|
+
const legacyRoomId = typeof project.code === "string"
|
|
101
|
+
? project.code
|
|
102
|
+
: roomId;
|
|
103
|
+
const agentIdentity = await ensureAgentIdentity();
|
|
104
|
+
const room = rememberRoom(toRoomState({
|
|
105
|
+
room_id: legacyRoomId,
|
|
106
|
+
project_id: typeof project.id === "string" ? project.id : null,
|
|
107
|
+
code: typeof project.code === "string" ? project.code : legacyRoomId,
|
|
108
|
+
display_name: typeof project.display_name === "string" ? project.display_name : null,
|
|
109
|
+
git_room: project.git_room ?? null,
|
|
110
|
+
joined_via: joinedVia,
|
|
111
|
+
}));
|
|
112
|
+
await syncRoomPresence(room.room_id, agentIdentity, {
|
|
113
|
+
status: "idle",
|
|
114
|
+
status_text: "available in room",
|
|
115
|
+
});
|
|
116
|
+
return {
|
|
117
|
+
room,
|
|
118
|
+
response: {
|
|
119
|
+
...project,
|
|
120
|
+
room_id: legacyRoomId,
|
|
121
|
+
project_id: typeof project.id === "string" ? project.id : null,
|
|
122
|
+
agent_identity: toPublicAgentIdentity(agentIdentity),
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const project = await apiCall(`/projects/room/${encodeURIComponent(roomId)}`, { method: "POST" });
|
|
127
|
+
const legacyRoomId = typeof project.name === "string" && project.name.trim()
|
|
128
|
+
? project.name
|
|
129
|
+
: typeof project.code === "string" && project.code.trim()
|
|
130
|
+
? project.code
|
|
131
|
+
: roomId;
|
|
132
|
+
const agentIdentity = await ensureAgentIdentity();
|
|
133
|
+
const room = rememberRoom(toRoomState({
|
|
134
|
+
room_id: legacyRoomId,
|
|
135
|
+
project_id: typeof project.id === "string" ? project.id : null,
|
|
136
|
+
code: typeof project.code === "string"
|
|
137
|
+
? project.code
|
|
138
|
+
: looksLikeInviteCode(legacyRoomId)
|
|
139
|
+
? legacyRoomId
|
|
140
|
+
: null,
|
|
141
|
+
display_name: typeof project.display_name === "string" ? project.display_name : null,
|
|
142
|
+
git_room: project.git_room ?? null,
|
|
143
|
+
joined_via: joinedVia,
|
|
144
|
+
}));
|
|
145
|
+
await syncRoomPresence(room.room_id, agentIdentity, {
|
|
146
|
+
status: "idle",
|
|
147
|
+
status_text: "available in room",
|
|
148
|
+
});
|
|
149
|
+
return {
|
|
150
|
+
room,
|
|
151
|
+
response: {
|
|
152
|
+
...project,
|
|
153
|
+
room_id: legacyRoomId,
|
|
154
|
+
project_id: typeof project.id === "string" ? project.id : null,
|
|
155
|
+
agent_identity: toPublicAgentIdentity(agentIdentity),
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
async function joinExistingRoomIdentifier(identifier, joinedVia) {
|
|
160
|
+
try {
|
|
161
|
+
return await joinRoomIdentifier(identifier, joinedVia, { allowCreate: false });
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
if (isNotFoundApiError(error)) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
export async function joinRoomIdentifierWithoutImplicitGitRefCreate(identifier, joinedVia, options = {}) {
|
|
171
|
+
const gitRefRoom = parseGeneratedGitRefRoomIdentifier(identifier);
|
|
172
|
+
if (!gitRefRoom) {
|
|
173
|
+
return joinRoomIdentifier(identifier, joinedVia);
|
|
174
|
+
}
|
|
175
|
+
const joined = await joinExistingRoomIdentifier(identifier, joinedVia);
|
|
176
|
+
if (joined) {
|
|
177
|
+
return joined;
|
|
178
|
+
}
|
|
179
|
+
if (options.fallbackToRepo) {
|
|
180
|
+
return joinRoomIdentifier(gitRefRoom.repoRoom, joinedVia);
|
|
181
|
+
}
|
|
182
|
+
throw new ApiError(404, JSON.stringify({
|
|
183
|
+
error: "Room not found",
|
|
184
|
+
code: "ROOM_NOT_FOUND",
|
|
185
|
+
room_id: identifier.trim(),
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
export async function createInviteRoom() {
|
|
189
|
+
const project = await apiCall("/projects", { method: "POST" });
|
|
190
|
+
const roomId = typeof project.code === "string"
|
|
191
|
+
? project.code
|
|
192
|
+
: typeof project.id === "string"
|
|
193
|
+
? project.id
|
|
194
|
+
: "unknown-room";
|
|
195
|
+
const room = rememberRoom(toRoomState({
|
|
196
|
+
room_id: roomId,
|
|
197
|
+
project_id: typeof project.id === "string" ? project.id : null,
|
|
198
|
+
code: typeof project.code === "string" ? project.code : roomId,
|
|
199
|
+
display_name: typeof project.display_name === "string" ? project.display_name : null,
|
|
200
|
+
joined_via: "join_code",
|
|
201
|
+
}));
|
|
202
|
+
const agentIdentity = await ensureAgentIdentity();
|
|
203
|
+
await syncRoomPresence(room.room_id, agentIdentity, {
|
|
204
|
+
status: "idle",
|
|
205
|
+
status_text: "available in room",
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
room,
|
|
209
|
+
response: {
|
|
210
|
+
...toPublicRoomResponse(project, roomId),
|
|
211
|
+
agent_identity: toPublicAgentIdentity(agentIdentity),
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
export async function buildJoinResponse(input) {
|
|
216
|
+
const basePayload = await withAgentIdentity({
|
|
217
|
+
...toPublicRoomResponse(input.joined.response, input.joined.room.room_id),
|
|
218
|
+
joined_via: input.joined_via,
|
|
219
|
+
session_mode: input.session_mode,
|
|
220
|
+
});
|
|
221
|
+
if (input.session_mode === "current") {
|
|
222
|
+
return withJoinRoomAgentPrompt(basePayload);
|
|
223
|
+
}
|
|
224
|
+
const provider = getDefaultManagedAgentProvider();
|
|
225
|
+
const liveSession = await provider.startLocalSession({
|
|
226
|
+
room_id: input.joined.room.room_id,
|
|
227
|
+
room_identifier: input.room_identifier,
|
|
228
|
+
room_code: input.joined.room.code ?? null,
|
|
229
|
+
room_display_name: input.joined.room.display_name ?? null,
|
|
230
|
+
joined_via: input.joined_via,
|
|
231
|
+
cwd: process.cwd(),
|
|
232
|
+
});
|
|
233
|
+
return withJoinRoomAgentPrompt({
|
|
234
|
+
...basePayload,
|
|
235
|
+
...toManagedAgentStartResponse(provider, liveSession),
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
export async function joinInviteCode(code, sessionMode) {
|
|
239
|
+
const joined = await joinRoomIdentifier(code, "join_code");
|
|
240
|
+
return buildJoinResponse({
|
|
241
|
+
joined,
|
|
242
|
+
room_identifier: normalizeInviteCode(code),
|
|
243
|
+
joined_via: "join_code",
|
|
244
|
+
session_mode: sessionMode,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
export async function joinNamedRoom(name, sessionMode) {
|
|
248
|
+
const joined = await joinRoomIdentifier(name, "join_room");
|
|
249
|
+
return buildJoinResponse({
|
|
250
|
+
joined,
|
|
251
|
+
room_identifier: name.trim(),
|
|
252
|
+
joined_via: "join_room",
|
|
253
|
+
session_mode: sessionMode,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
export async function autoJoinFromContext() {
|
|
257
|
+
try {
|
|
258
|
+
const configRoom = getRoomFromConfig();
|
|
259
|
+
if (configRoom) {
|
|
260
|
+
const gitContext = buildActiveGitRoomContext({
|
|
261
|
+
repoRoom: configRoom,
|
|
262
|
+
currentBranch: getGitCurrentBranch(),
|
|
263
|
+
defaultBranch: getGitDefaultBranch(),
|
|
264
|
+
});
|
|
265
|
+
if (gitContext.activeRefRoom && gitContext.currentBranch) {
|
|
266
|
+
const joinedBranchRoom = await joinExistingRoomIdentifier(gitContext.activeRefRoom, "config");
|
|
267
|
+
if (joinedBranchRoom) {
|
|
268
|
+
await ensureAgentIdentity();
|
|
269
|
+
console.error(`đ Auto-joined existing branch room '${gitContext.activeRefRoom}' (from .letagents.json + branch '${gitContext.currentBranch}')`);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
await joinRoomIdentifier(configRoom, "config");
|
|
274
|
+
await ensureAgentIdentity();
|
|
275
|
+
const branchNote = gitContext.activeRefRoom && gitContext.currentBranch
|
|
276
|
+
? `; branch '${gitContext.currentBranch}' has no existing Git Room`
|
|
277
|
+
: "";
|
|
278
|
+
console.error(`đ Auto-joined room '${configRoom}' (from .letagents.json${branchNote})`);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const gitContext = getGitRoomContext();
|
|
282
|
+
if (gitContext.repoRoom) {
|
|
283
|
+
if (gitContext.activeRefRoom && gitContext.currentBranch) {
|
|
284
|
+
const joinedBranchRoom = await joinExistingRoomIdentifier(gitContext.activeRefRoom, "git-remote");
|
|
285
|
+
if (joinedBranchRoom) {
|
|
286
|
+
await ensureAgentIdentity();
|
|
287
|
+
console.error(`đ Auto-joined existing branch room '${gitContext.activeRefRoom}' (inferred from git remote and branch '${gitContext.currentBranch}' â consider adding a .letagents.json)`);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
await joinRoomIdentifier(gitContext.repoRoom, "git-remote");
|
|
292
|
+
await ensureAgentIdentity();
|
|
293
|
+
const branchNote = gitContext.activeRefRoom && gitContext.currentBranch
|
|
294
|
+
? `; branch '${gitContext.currentBranch}' has no existing Git Room`
|
|
295
|
+
: "";
|
|
296
|
+
console.error(`đ Auto-joined room '${gitContext.repoRoom}' (inferred from git remote${branchNote} â consider adding a .letagents.json)`);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const savedCurrentRoom = getStoredCurrentRoom();
|
|
300
|
+
if (savedCurrentRoom) {
|
|
301
|
+
const joined = await joinRoomIdentifierWithoutImplicitGitRefCreate(savedCurrentRoom.room_id, savedCurrentRoom.joined_via, { fallbackToRepo: true });
|
|
302
|
+
await ensureAgentIdentity();
|
|
303
|
+
const fallbackNote = joined.room.room_id !== savedCurrentRoom.room_id
|
|
304
|
+
? `; saved Git ref room '${savedCurrentRoom.room_id}' was missing`
|
|
305
|
+
: "";
|
|
306
|
+
console.error(`đ Rejoined saved room '${joined.room.room_id}' (from local state${fallbackNote})`);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
console.error("âšī¸ No .letagents.json, git remote, or saved room found â use create_room, join_code, or join_room to connect.");
|
|
310
|
+
}
|
|
311
|
+
catch (err) {
|
|
312
|
+
if (err instanceof RepoRoomAuthRequiredError) {
|
|
313
|
+
console.error(`đ Repo room auth required for '${err.roomId}'. Open ${err.pendingAuth.verification_uri} and enter code ${err.pendingAuth.user_code}, then run poll_device_auth.`);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
console.error("â ī¸ Auto-join failed (server still running):", err instanceof Error ? err.message : err);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Compatibility facade for MCP server runtime helpers. The implementation lives
|
|
2
|
+
// in src/mcp/server/runtime/* so tool modules can import focused responsibilities
|
|
3
|
+
// without turning this file back into the runtime god module.
|
|
4
|
+
export { API_URL, ApiError, apiCall, getAuthorizationHeader, getLetagentsToken, isMissingRouteError, parseApiErrorPayload, resolveApiPath, } from "./runtime/api.js";
|
|
5
|
+
export { clearAuthenticatedAccountCache, getAuthenticatedAccountCache, setAuthenticatedAccountCache, } from "./runtime/auth-cache.js";
|
|
6
|
+
export { RepoRoomAuthRequiredError, maybeHandleRepoRoomAuthRequired, startPendingDeviceAuth, toRepoRoomAuthRequiredResult, } from "./runtime/device-auth.js";
|
|
7
|
+
export { AGENT_INSTANCE_UUID, currentAgentIdentity, currentAgentIdentityKey, detectAgentIdeLabel, detectAgentRuntimeLabel, ensureAgentIdentity, getConversationIdentity, getSessionLivenessRegistration, resolveOwnerContext, setConversationIdentity, storeCurrentAgentIdentity, toPublicAgentIdentity, withAgentIdentity, } from "./runtime/identity.js";
|
|
8
|
+
export { agentSessionCredentials, buildAgentDeliveryHeaders, ensureLocalWorkerAgentSession, getAgentSessionRepoBranch, identityFromAgentSession, requireWorkerAgentSession, resolveAgentSession, resolveWorkerToolIdentity, toPublicAgentSession, } from "./runtime/agent-sessions.js";
|
|
9
|
+
export { appendIncludePromptOnly, getLastMessageId, normalizeOptionalToolString, toAgentReadableMessages, withJoinRoomAgentPrompt, } from "./runtime/messages.js";
|
|
10
|
+
export { currentRoom, attachMcpServer, getFallbackProjectId, getTargetRoomId, rememberRoom, shutdownRuntime, toPublicRoomResponse, toPublicRoomState, toPublicStoredRoomSession, toRoomState, touchCurrentRoom, withCanonicalRoomLink, } from "./runtime/room-state.js";
|
|
11
|
+
export { getRememberedRoomPresence, heartbeatRoomPresence, syncRoomPresence, } from "./runtime/presence.js";
|
|
12
|
+
export { roomScopedApiCall } from "./runtime/room-api.js";
|
|
13
|
+
export { autoJoinFromContext, buildJoinResponse, createInviteRoom, getCurrentLiveSessionPayload, joinInviteCode, joinNamedRoom, joinRoomIdentifier, joinRoomIdentifierWithoutImplicitGitRefCreate, normalizeJoinSessionMode, } from "./runtime/rooms.js";
|
|
14
|
+
export { clearPendingDeviceAuth, clearStoredAuth, clearStoredAuth as clearStoredAuthorization, endStoredAgentSession, getCurrentAgentSession, getLocalStatePath, getPendingDeviceAuth, getStoredAgentIdentity, getStoredAgentSession, getStoredAuth, getStoredCurrentRoom, getStoredRoomSession, listStoredCodexLiveSessions, saveAgentSession, setPendingDeviceAuth, setStoredAuth, setStoredAgentIdentity, touchRoomSession, addLocalChatMessage, addLocalTask, claimLocalTaskReviewLease, getLatestLocalChatMessages, getLocalChatMessages, getLocalTask, listLocalTasks, isLocalChatStorageEnabled, isLocalRoomStorageEnabled, resolveLocalRoomStorageIdentifiers, releaseLocalTaskReviewLease, updateLocalTask, waitForLocalChatMessages, } from "../local-state.js";
|