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,121 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { deriveTaskPresenceStatus } from "../../../agent-presence.js";
|
|
3
|
+
import { getRememberedRoomPresence, syncRoomPresence, toPublicAgentIdentity, } from "../../runtime.js";
|
|
4
|
+
import { patchTask } from "./api.js";
|
|
5
|
+
import { resolveTaskToolIdentity, resolveTaskToolTarget, taskActorPayload, } from "./context.js";
|
|
6
|
+
import { jsonToolResponse, taskToolError } from "./response.js";
|
|
7
|
+
import { deprecatedAssigneeSchema, boardIntentApprovalSchema, TASK_STATUSES, workerTaskIdentitySchema, workflowArtifactSchema, } from "./schemas.js";
|
|
8
|
+
export function registerTaskMutationTools(server) {
|
|
9
|
+
server.tool("claim_task", "Claim an accepted task. The task must be in 'accepted' " +
|
|
10
|
+
"status. This sets the assignee to you and moves the status to 'assigned'. " +
|
|
11
|
+
"Do NOT claim proposed tasks — they need to be accepted first.", {
|
|
12
|
+
task_id: z.string().describe("The task ID to claim, e.g. 'task_1'"),
|
|
13
|
+
assignee: deprecatedAssigneeSchema,
|
|
14
|
+
...workerTaskIdentitySchema,
|
|
15
|
+
...boardIntentApprovalSchema,
|
|
16
|
+
}, async ({ task_id, assignee: _assignee, room_id, conversation_id: _conversation_id, agent_session_id, board_intent_id, board_approval_token }) => {
|
|
17
|
+
const target = resolveTaskToolTarget(room_id);
|
|
18
|
+
if (!target)
|
|
19
|
+
return taskToolError("Not in a room.");
|
|
20
|
+
try {
|
|
21
|
+
const { identity, agentSession } = await resolveTaskToolIdentity(target, agent_session_id);
|
|
22
|
+
const updated = await patchTask(target, task_id, {
|
|
23
|
+
status: "assigned",
|
|
24
|
+
assignee: identity.actor_label,
|
|
25
|
+
...taskActorPayload(identity, agentSession),
|
|
26
|
+
assignee_agent_key: identity.canonical_key,
|
|
27
|
+
board_intent_id,
|
|
28
|
+
board_approval_token,
|
|
29
|
+
});
|
|
30
|
+
await syncRoomPresence(target.effectiveRoomId, identity, {
|
|
31
|
+
status: "working",
|
|
32
|
+
status_text: `claimed ${task_id}`,
|
|
33
|
+
}, agentSession);
|
|
34
|
+
return jsonToolResponse({ success: true, task: updated, agent_identity: toPublicAgentIdentity(identity) }, 2);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return taskToolError(String(error));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
server.tool("update_task", "Update a task's status or assignee. Status transitions are validated — " +
|
|
41
|
+
"only valid transitions are allowed (e.g. in_progress → in_review, " +
|
|
42
|
+
"but NOT proposed → in_progress).", {
|
|
43
|
+
task_id: z.string().describe("The task ID to update"),
|
|
44
|
+
status: z.enum(TASK_STATUSES).optional().describe("New status for the task"),
|
|
45
|
+
assignee: z
|
|
46
|
+
.string()
|
|
47
|
+
.optional()
|
|
48
|
+
.describe("New assignee for the task. Defaults to the current agent when status=assigned."),
|
|
49
|
+
pr_url: z.string().optional().describe("PR URL to link to the task"),
|
|
50
|
+
workflow_artifacts: z
|
|
51
|
+
.array(workflowArtifactSchema)
|
|
52
|
+
.max(32)
|
|
53
|
+
.optional()
|
|
54
|
+
.describe("Persisted provider-neutral task workflow artifacts to attach to the task"),
|
|
55
|
+
...workerTaskIdentitySchema,
|
|
56
|
+
...boardIntentApprovalSchema,
|
|
57
|
+
}, async ({ task_id, status, assignee, pr_url, workflow_artifacts, room_id, conversation_id: _conversation_id, agent_session_id, board_intent_id, board_approval_token }) => {
|
|
58
|
+
const target = resolveTaskToolTarget(room_id);
|
|
59
|
+
if (!target)
|
|
60
|
+
return taskToolError("Not in a room.");
|
|
61
|
+
try {
|
|
62
|
+
const { identity, agentSession } = await resolveTaskToolIdentity(target, agent_session_id);
|
|
63
|
+
const rememberedPresence = getRememberedRoomPresence(target.effectiveRoomId, identity);
|
|
64
|
+
const nextAssignee = status === "assigned" && !assignee ? identity.actor_label : assignee;
|
|
65
|
+
const nextAssigneeAgentKey = nextAssignee === identity.actor_label ? identity.canonical_key : undefined;
|
|
66
|
+
const updated = await patchTask(target, task_id, {
|
|
67
|
+
status,
|
|
68
|
+
assignee: nextAssignee,
|
|
69
|
+
assignee_agent_key: nextAssigneeAgentKey,
|
|
70
|
+
pr_url,
|
|
71
|
+
workflow_artifacts,
|
|
72
|
+
board_intent_id,
|
|
73
|
+
board_approval_token,
|
|
74
|
+
...taskActorPayload(identity, agentSession),
|
|
75
|
+
});
|
|
76
|
+
await syncRoomPresence(target.effectiveRoomId, identity, {
|
|
77
|
+
status: deriveTaskPresenceStatus(status ?? null, rememberedPresence.status),
|
|
78
|
+
status_text: status ? `${task_id} -> ${status}` : rememberedPresence.status_text,
|
|
79
|
+
}, agentSession);
|
|
80
|
+
return jsonToolResponse({
|
|
81
|
+
success: true,
|
|
82
|
+
task: updated,
|
|
83
|
+
agent_identity: toPublicAgentIdentity(identity),
|
|
84
|
+
}, 2);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
return taskToolError(String(error));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
server.tool("complete_task", "Submit a task for review. Moves the task to 'in_review' status. " +
|
|
91
|
+
"Optionally attach a PR URL. After this, a reviewer must confirm " +
|
|
92
|
+
"the work is merged before it can be marked done.", {
|
|
93
|
+
task_id: z.string().describe("The task ID to submit for review"),
|
|
94
|
+
pr_url: z.string().optional().describe("GitHub PR URL for the work"),
|
|
95
|
+
...workerTaskIdentitySchema,
|
|
96
|
+
}, async ({ task_id, pr_url, room_id, conversation_id: _conversation_id, agent_session_id }) => {
|
|
97
|
+
const target = resolveTaskToolTarget(room_id);
|
|
98
|
+
if (!target)
|
|
99
|
+
return taskToolError("Not in a room.");
|
|
100
|
+
try {
|
|
101
|
+
const { identity, agentSession } = await resolveTaskToolIdentity(target, agent_session_id);
|
|
102
|
+
const updated = await patchTask(target, task_id, {
|
|
103
|
+
status: "in_review",
|
|
104
|
+
pr_url,
|
|
105
|
+
...taskActorPayload(identity, agentSession),
|
|
106
|
+
});
|
|
107
|
+
await syncRoomPresence(target.effectiveRoomId, identity, {
|
|
108
|
+
status: "reviewing",
|
|
109
|
+
status_text: `${task_id} -> in_review`,
|
|
110
|
+
}, agentSession);
|
|
111
|
+
return jsonToolResponse({
|
|
112
|
+
success: true,
|
|
113
|
+
task: updated,
|
|
114
|
+
agent_identity: toPublicAgentIdentity(identity),
|
|
115
|
+
}, 2);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
return taskToolError(String(error));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function jsonToolResponse(value, space) {
|
|
2
|
+
return {
|
|
3
|
+
content: [
|
|
4
|
+
{
|
|
5
|
+
type: "text",
|
|
6
|
+
text: JSON.stringify(value, null, space),
|
|
7
|
+
},
|
|
8
|
+
],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export function taskToolError(error) {
|
|
12
|
+
return jsonToolResponse({ success: false, error });
|
|
13
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const TASK_STATUSES = [
|
|
3
|
+
"proposed",
|
|
4
|
+
"accepted",
|
|
5
|
+
"assigned",
|
|
6
|
+
"in_progress",
|
|
7
|
+
"blocked",
|
|
8
|
+
"in_review",
|
|
9
|
+
"merged",
|
|
10
|
+
"done",
|
|
11
|
+
"cancelled",
|
|
12
|
+
];
|
|
13
|
+
export const workerTaskIdentitySchema = {
|
|
14
|
+
room_id: z.string().optional().describe("Canonical room ID. Defaults to current room."),
|
|
15
|
+
conversation_id: z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("Deprecated for worker writes; registered worker session identity is used."),
|
|
19
|
+
agent_session_id: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Registered agent session to use for this task action. Required for worker task writes."),
|
|
23
|
+
};
|
|
24
|
+
export const boardIntentApprovalSchema = {
|
|
25
|
+
board_intent_id: z.string().optional().describe("Approved board intent id for high-impact board actions."),
|
|
26
|
+
board_approval_token: z.string().optional().describe("Scoped approval token returned by approve_board_intent for non-task_create intents."),
|
|
27
|
+
};
|
|
28
|
+
export const taskReviewIdentitySchema = {
|
|
29
|
+
...workerTaskIdentitySchema,
|
|
30
|
+
agent_session_id: z
|
|
31
|
+
.string()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("Registered agent session to use for this review action. Required for worker review writes."),
|
|
34
|
+
};
|
|
35
|
+
export const taskLeaseIdentitySchema = {
|
|
36
|
+
...workerTaskIdentitySchema,
|
|
37
|
+
agent_session_id: z
|
|
38
|
+
.string()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe("Registered agent session to use for this lease action. Required for worker lease writes."),
|
|
41
|
+
};
|
|
42
|
+
export const deprecatedAssigneeSchema = z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Deprecated override. Agent identity is resolved automatically on room entry.");
|
|
46
|
+
export const workflowArtifactSchema = z
|
|
47
|
+
.object({
|
|
48
|
+
provider: z.enum(["git", "github", "gitlab", "bitbucket", "unknown"]),
|
|
49
|
+
kind: z.enum([
|
|
50
|
+
"issue",
|
|
51
|
+
"branch",
|
|
52
|
+
"commit",
|
|
53
|
+
"diff",
|
|
54
|
+
"change_summary",
|
|
55
|
+
"pull_request",
|
|
56
|
+
"merge_request",
|
|
57
|
+
"review",
|
|
58
|
+
"check_run",
|
|
59
|
+
"merge",
|
|
60
|
+
]),
|
|
61
|
+
id: z.string().nullable().optional(),
|
|
62
|
+
number: z.number().int().nullable().optional(),
|
|
63
|
+
title: z.string().nullable().optional(),
|
|
64
|
+
url: z.string().nullable().optional(),
|
|
65
|
+
ref: z.string().nullable().optional(),
|
|
66
|
+
state: z.string().nullable().optional(),
|
|
67
|
+
})
|
|
68
|
+
.strict();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerTaskTools } from "./tasks/index.js";
|