replicas-engine 0.1.1090 → 0.1.1091
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/dist/src/{asp-host-QU64FY3O.js → asp-host-PUE6PO3M.js} +5 -5
- package/dist/src/{chunk-P26KTSV5.js → chunk-4WVWTCMX.js} +2 -2
- package/dist/src/{chunk-653DTHKB.js → chunk-BYGDQGC3.js} +648 -611
- package/dist/src/{chunk-HP7EUHEG.js → chunk-DGBXHS6V.js} +2 -2
- package/dist/src/{chunk-HME4KTA7.js → chunk-NRIVUVIQ.js} +6 -6
- package/dist/src/{chunk-47R46BP5.js → chunk-OQ7SHJOY.js} +3 -3
- package/dist/src/{chunk-GJLRFGVA.js → chunk-S25A42D5.js} +1 -1
- package/dist/src/{chunk-NYHJ4RRH.js → chunk-VMNOGLHB.js} +2 -2
- package/dist/src/{chunk-FWJBDU4E.js → chunk-YZU2ZI4H.js} +1 -1
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +8 -8
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -217,6 +217,135 @@ var ASTER_MODEL_LABELS = {
|
|
|
217
217
|
"gpt-oss-120b": "GPT-OSS 120B"
|
|
218
218
|
};
|
|
219
219
|
|
|
220
|
+
// ../shared/src/routes/reviews.ts
|
|
221
|
+
import { z as z2 } from "zod";
|
|
222
|
+
|
|
223
|
+
// ../shared/src/github/url.ts
|
|
224
|
+
var GITHUB_HOST_RE = /(^|@|\/\/)github\.com[:/]/;
|
|
225
|
+
var GITHUB_REPO_SLUG_RE = /github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?(?:[/?#]|$)/i;
|
|
226
|
+
function isGitHubUrl(url) {
|
|
227
|
+
if (!url) return false;
|
|
228
|
+
return GITHUB_HOST_RE.test(url);
|
|
229
|
+
}
|
|
230
|
+
function parseRepoUrlSlug(url) {
|
|
231
|
+
if (!url) return null;
|
|
232
|
+
const match = url.match(GITHUB_REPO_SLUG_RE);
|
|
233
|
+
if (!match) return null;
|
|
234
|
+
return { owner: match[1].toLowerCase(), repo: match[2].toLowerCase() };
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// ../shared/src/urls.ts
|
|
238
|
+
var DASHBOARD_PATH = "/dashboard";
|
|
239
|
+
var WEB_APP_PATHS = {
|
|
240
|
+
home: "/",
|
|
241
|
+
onboarding: "/onboarding",
|
|
242
|
+
workspaces: "/workspace",
|
|
243
|
+
environmentSetup: "/workspace/setup",
|
|
244
|
+
automations: "/automations",
|
|
245
|
+
environment: "/environment",
|
|
246
|
+
analytics: "/analytics",
|
|
247
|
+
review: "/review",
|
|
248
|
+
dashboard: DASHBOARD_PATH,
|
|
249
|
+
agents: `${DASHBOARD_PATH}/agents`,
|
|
250
|
+
integrations: `${DASHBOARD_PATH}/integrations`,
|
|
251
|
+
integrationsGithub: `${DASHBOARD_PATH}/integrations/github`,
|
|
252
|
+
integrationsGitlab: `${DASHBOARD_PATH}/integrations/gitlab`,
|
|
253
|
+
settings: `${DASHBOARD_PATH}/settings`,
|
|
254
|
+
billing: `${DASHBOARD_PATH}/billing`,
|
|
255
|
+
members: `${DASHBOARD_PATH}/members`,
|
|
256
|
+
learnings: `${DASHBOARD_PATH}/learnings`,
|
|
257
|
+
"audit-logs": `${DASHBOARD_PATH}/audit-logs`,
|
|
258
|
+
accountAgents: `${DASHBOARD_PATH}/account/agents`,
|
|
259
|
+
accountProfile: `${DASHBOARD_PATH}/account/profile`,
|
|
260
|
+
accountConnections: `${DASHBOARD_PATH}/account/connections`,
|
|
261
|
+
accountIntegrations: `${DASHBOARD_PATH}/account/integrations`,
|
|
262
|
+
accountApiKeys: `${DASHBOARD_PATH}/account/api-keys`,
|
|
263
|
+
accountPreferences: `${DASHBOARD_PATH}/account/preferences`,
|
|
264
|
+
fullscreenWorkspaces: "/workspaces"
|
|
265
|
+
};
|
|
266
|
+
var LEGACY_WEB_APP_PATHS = {
|
|
267
|
+
app: "/app",
|
|
268
|
+
home: "/home",
|
|
269
|
+
dashboardWorkspaces: `${DASHBOARD_PATH}/workspaces`
|
|
270
|
+
};
|
|
271
|
+
var PR_URL_REGEX = /github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/;
|
|
272
|
+
function parsePrUrl(url) {
|
|
273
|
+
const match = url.match(PR_URL_REGEX);
|
|
274
|
+
if (!match) return null;
|
|
275
|
+
const [, owner, repo, numberStr] = match;
|
|
276
|
+
const number = Number.parseInt(numberStr, 10);
|
|
277
|
+
if (!Number.isFinite(number)) return null;
|
|
278
|
+
return { owner, repo, number };
|
|
279
|
+
}
|
|
280
|
+
function parseCodeHostPrUrl(url) {
|
|
281
|
+
const github = parsePrUrl(url);
|
|
282
|
+
if (github) {
|
|
283
|
+
return {
|
|
284
|
+
...github,
|
|
285
|
+
provider: "github",
|
|
286
|
+
host: "github.com",
|
|
287
|
+
repositoryPath: `${github.owner}/${github.repo}`,
|
|
288
|
+
repoUrl: `https://github.com/${github.owner}/${github.repo}`
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
let parsed;
|
|
292
|
+
try {
|
|
293
|
+
parsed = new URL(url);
|
|
294
|
+
} catch {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
|
|
298
|
+
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
299
|
+
const separatorIndex = segments.indexOf("-");
|
|
300
|
+
if (separatorIndex <= 0 || segments[separatorIndex + 1] !== "merge_requests") return null;
|
|
301
|
+
const number = Number.parseInt(segments[separatorIndex + 2] ?? "", 10);
|
|
302
|
+
if (!Number.isFinite(number)) return null;
|
|
303
|
+
const repositorySegments = decodePathSegments(segments.slice(0, separatorIndex));
|
|
304
|
+
const repo = repositorySegments[repositorySegments.length - 1];
|
|
305
|
+
const owner = repositorySegments[0];
|
|
306
|
+
if (!owner || !repo) return null;
|
|
307
|
+
const repositoryPath = repositorySegments.join("/");
|
|
308
|
+
return {
|
|
309
|
+
provider: "gitlab",
|
|
310
|
+
host: parsed.host.toLowerCase(),
|
|
311
|
+
owner,
|
|
312
|
+
repo,
|
|
313
|
+
number,
|
|
314
|
+
repositoryPath,
|
|
315
|
+
repoUrl: `${parsed.origin}/${repositoryPath}`
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function decodePathSegments(segments) {
|
|
319
|
+
return segments.map((segment) => {
|
|
320
|
+
try {
|
|
321
|
+
return decodeURIComponent(segment);
|
|
322
|
+
} catch {
|
|
323
|
+
return segment;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function buildCodeHostPrUrl(repoUrl, provider2, prNumber) {
|
|
328
|
+
const normalizedRepoUrl = repoUrl.replace(/\.git$/, "");
|
|
329
|
+
if (provider2 === "gitlab") {
|
|
330
|
+
return `${normalizedRepoUrl}/-/merge_requests/${prNumber}`;
|
|
331
|
+
}
|
|
332
|
+
return `${normalizedRepoUrl}/pull/${prNumber}`;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// ../shared/src/routes/reviews.ts
|
|
336
|
+
var text = z2.string().trim().catch("");
|
|
337
|
+
var optionalText = z2.string().trim().min(1).optional().catch(void 0);
|
|
338
|
+
var pullRequestTourSchema = z2.object({
|
|
339
|
+
/** The tour chat that wrote this file, so a rerun doesn't show the previous run's tour as in progress. */
|
|
340
|
+
runId: optionalText,
|
|
341
|
+
headSha: optionalText,
|
|
342
|
+
status: z2.enum(["writing", "done"]).catch("writing"),
|
|
343
|
+
summary: text,
|
|
344
|
+
diagram: optionalText,
|
|
345
|
+
files: z2.array(z2.object({ path: text, explanation: text })).catch([]),
|
|
346
|
+
skip: z2.array(z2.object({ path: text, note: text })).catch([])
|
|
347
|
+
});
|
|
348
|
+
|
|
220
349
|
// ../shared/src/languages.ts
|
|
221
350
|
var EXT_TO_LANGUAGE = {
|
|
222
351
|
".ts": "typescript",
|
|
@@ -736,7 +865,7 @@ function paginateEngineLogContent(input) {
|
|
|
736
865
|
}
|
|
737
866
|
|
|
738
867
|
// ../shared/src/analytics/types.ts
|
|
739
|
-
import { z as
|
|
868
|
+
import { z as z3 } from "zod";
|
|
740
869
|
|
|
741
870
|
// ../shared/src/external-api-host.ts
|
|
742
871
|
function validateExternalApiHost(url, providerLabel) {
|
|
@@ -1169,19 +1298,19 @@ function hasAgentChatActivityFields(value) {
|
|
|
1169
1298
|
function isAgentChatActivityRecord(value) {
|
|
1170
1299
|
return hasAgentChatActivityFields(value) && typeof value.provider === "string" && isValidAgentProvider(value.provider);
|
|
1171
1300
|
}
|
|
1172
|
-
var credentialAccountSchema =
|
|
1173
|
-
ownerName:
|
|
1174
|
-
email:
|
|
1301
|
+
var credentialAccountSchema = z3.object({
|
|
1302
|
+
ownerName: z3.string().optional(),
|
|
1303
|
+
email: z3.string().optional(),
|
|
1175
1304
|
/** 1-based place in the owner's account pool, set only when the pool holds several accounts. */
|
|
1176
|
-
ordinal:
|
|
1305
|
+
ordinal: z3.number().int().positive().optional()
|
|
1177
1306
|
});
|
|
1178
|
-
var agentCredentialSnapshotSchema =
|
|
1179
|
-
method:
|
|
1180
|
-
scope:
|
|
1181
|
-
revision:
|
|
1307
|
+
var agentCredentialSnapshotSchema = z3.object({
|
|
1308
|
+
method: z3.enum(CREDENTIAL_METHOD),
|
|
1309
|
+
scope: z3.enum(CREDENTIAL_SCOPE),
|
|
1310
|
+
revision: z3.string().optional(),
|
|
1182
1311
|
account: credentialAccountSchema.optional(),
|
|
1183
1312
|
/** The `credentials` row, which tells apart accounts pooled under one method and scope. */
|
|
1184
|
-
credentialId:
|
|
1313
|
+
credentialId: z3.string().optional()
|
|
1185
1314
|
});
|
|
1186
1315
|
function isSameCredential(a, b) {
|
|
1187
1316
|
return a.method === b.method && a.scope === b.scope && a.credentialId === b.credentialId;
|
|
@@ -1227,14 +1356,14 @@ function coerceClaudePartialMessagePayload(payload) {
|
|
|
1227
1356
|
const streamId = payload.streamId;
|
|
1228
1357
|
if (typeof streamId !== "string" || !streamId) return null;
|
|
1229
1358
|
const parentToolUseId = payload.parent_tool_use_id;
|
|
1230
|
-
const
|
|
1359
|
+
const text3 = typeof payload.text === "string" && payload.text ? payload.text : void 0;
|
|
1231
1360
|
const thinking = typeof payload.thinking === "string" && payload.thinking ? payload.thinking : void 0;
|
|
1232
1361
|
const tool = isRecord(payload.tool) && typeof payload.tool.id === "string" && typeof payload.tool.name === "string" ? typeof payload.tool.filePath === "string" ? { id: payload.tool.id, name: payload.tool.name, filePath: payload.tool.filePath } : typeof payload.tool.command === "string" ? { id: payload.tool.id, name: payload.tool.name, command: payload.tool.command } : void 0 : void 0;
|
|
1233
|
-
if (!
|
|
1362
|
+
if (!text3 && !thinking && !tool) return null;
|
|
1234
1363
|
return {
|
|
1235
1364
|
streamId,
|
|
1236
1365
|
parent_tool_use_id: typeof parentToolUseId === "string" ? parentToolUseId : null,
|
|
1237
|
-
...
|
|
1366
|
+
...text3 ? { text: text3 } : {},
|
|
1238
1367
|
...thinking ? { thinking } : {},
|
|
1239
1368
|
...tool ? { tool } : {},
|
|
1240
1369
|
status: payload.status === "completed" ? "completed" : "in_progress"
|
|
@@ -1329,105 +1458,105 @@ function coerceChatGoalPayload(payload) {
|
|
|
1329
1458
|
var CONTEXT_USAGE_EVENT_TYPE = "context-usage";
|
|
1330
1459
|
|
|
1331
1460
|
// ../shared/src/engine/v1.ts
|
|
1332
|
-
import { z as
|
|
1461
|
+
import { z as z4 } from "zod";
|
|
1333
1462
|
var MERGED_MESSAGE_SEPARATOR = "\n\n<!-- replicas:merged -->\n\n";
|
|
1334
1463
|
var ENGINE_HEALTH_WAIT_HEADER = "X-Replicas-Health-Wait";
|
|
1335
1464
|
var ENGINE_HEALTH_WAIT_QUERY_PARAM = "wait_ms";
|
|
1336
1465
|
var ENGINE_HEALTH_MAX_WAIT_MS = 2e3;
|
|
1337
1466
|
var ENGINE_ACTIVATE_PATH = "/lifecycle/activate";
|
|
1338
1467
|
var ENGINE_SLEEP_PATH = "/lifecycle/sleep";
|
|
1339
|
-
var updateChatDisplayNameRequestSchema =
|
|
1340
|
-
displayName:
|
|
1468
|
+
var updateChatDisplayNameRequestSchema = z4.object({
|
|
1469
|
+
displayName: z4.string().trim().min(1).max(100)
|
|
1341
1470
|
});
|
|
1342
|
-
var createChatRequestSchema =
|
|
1343
|
-
id:
|
|
1344
|
-
createdAt:
|
|
1345
|
-
provider:
|
|
1346
|
-
title:
|
|
1347
|
-
parentChatId:
|
|
1348
|
-
forkSourceChatId:
|
|
1349
|
-
sideChat:
|
|
1350
|
-
clientRequestId:
|
|
1471
|
+
var createChatRequestSchema = z4.object({
|
|
1472
|
+
id: z4.string().uuid().optional(),
|
|
1473
|
+
createdAt: z4.string().datetime().optional(),
|
|
1474
|
+
provider: z4.enum(VALID_AGENT_PROVIDERS),
|
|
1475
|
+
title: z4.string().min(1).optional(),
|
|
1476
|
+
parentChatId: z4.string().uuid().optional(),
|
|
1477
|
+
forkSourceChatId: z4.string().uuid().optional(),
|
|
1478
|
+
sideChat: z4.boolean().optional(),
|
|
1479
|
+
clientRequestId: z4.string().min(1).max(128).optional()
|
|
1351
1480
|
}).refine((request) => !request.sideChat || request.forkSourceChatId !== void 0 && request.parentChatId === request.forkSourceChatId, {
|
|
1352
1481
|
message: "A side chat must fork its parent chat"
|
|
1353
1482
|
});
|
|
1354
|
-
var spawnSubagentRequestSchema =
|
|
1355
|
-
provider:
|
|
1356
|
-
prompt:
|
|
1357
|
-
forkTurns:
|
|
1483
|
+
var spawnSubagentRequestSchema = z4.object({
|
|
1484
|
+
provider: z4.enum(VALID_AGENT_PROVIDERS),
|
|
1485
|
+
prompt: z4.string().min(1),
|
|
1486
|
+
forkTurns: z4.string().regex(/^(all|none|[1-9]\d*)$/).refine(
|
|
1358
1487
|
(value) => value === "all" || value === "none" || Number.isSafeInteger(Number(value)),
|
|
1359
1488
|
"Expected all, none, or a positive safe integer string"
|
|
1360
1489
|
).default("all"),
|
|
1361
|
-
model:
|
|
1362
|
-
thinkingLevel:
|
|
1363
|
-
title:
|
|
1490
|
+
model: z4.string().min(1).optional(),
|
|
1491
|
+
thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional(),
|
|
1492
|
+
title: z4.string().min(1).optional()
|
|
1364
1493
|
});
|
|
1365
|
-
var messageSubagentRequestSchema =
|
|
1366
|
-
message:
|
|
1367
|
-
model:
|
|
1368
|
-
thinkingLevel:
|
|
1494
|
+
var messageSubagentRequestSchema = z4.object({
|
|
1495
|
+
message: z4.string().min(1),
|
|
1496
|
+
model: z4.string().min(1).optional(),
|
|
1497
|
+
thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional()
|
|
1369
1498
|
});
|
|
1370
|
-
var waitSubagentRequestSchema =
|
|
1371
|
-
timeoutMinutes:
|
|
1499
|
+
var waitSubagentRequestSchema = z4.object({
|
|
1500
|
+
timeoutMinutes: z4.coerce.number().positive().max(1440).optional()
|
|
1372
1501
|
});
|
|
1373
|
-
var subagentResponseSchema =
|
|
1374
|
-
chatId:
|
|
1375
|
-
status:
|
|
1376
|
-
response:
|
|
1377
|
-
timedOut:
|
|
1378
|
-
interruptedByUserMessage:
|
|
1502
|
+
var subagentResponseSchema = z4.object({
|
|
1503
|
+
chatId: z4.string().uuid(),
|
|
1504
|
+
status: z4.enum(["working", "completed"]),
|
|
1505
|
+
response: z4.string().optional(),
|
|
1506
|
+
timedOut: z4.literal(true).optional(),
|
|
1507
|
+
interruptedByUserMessage: z4.literal(true).optional()
|
|
1379
1508
|
});
|
|
1380
|
-
var integrationErrorNotificationTargetSchema =
|
|
1381
|
-
|
|
1382
|
-
type:
|
|
1383
|
-
conversation:
|
|
1384
|
-
channelId:
|
|
1385
|
-
threadTs:
|
|
1509
|
+
var integrationErrorNotificationTargetSchema = z4.discriminatedUnion("type", [
|
|
1510
|
+
z4.object({
|
|
1511
|
+
type: z4.literal("slack"),
|
|
1512
|
+
conversation: z4.object({
|
|
1513
|
+
channelId: z4.string().min(1),
|
|
1514
|
+
threadTs: z4.string().min(1)
|
|
1386
1515
|
}).optional()
|
|
1387
1516
|
}),
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
type:
|
|
1391
|
-
provider:
|
|
1392
|
-
resource:
|
|
1393
|
-
repositoryId:
|
|
1394
|
-
resourceNumber:
|
|
1517
|
+
z4.object({ type: z4.literal("linear"), sessionId: z4.string().min(1) }),
|
|
1518
|
+
z4.object({
|
|
1519
|
+
type: z4.literal("code_host"),
|
|
1520
|
+
provider: z4.enum(["github", "gitlab"]),
|
|
1521
|
+
resource: z4.enum(["issue", "pull_request"]),
|
|
1522
|
+
repositoryId: z4.string().min(1),
|
|
1523
|
+
resourceNumber: z4.number().int().positive()
|
|
1395
1524
|
}),
|
|
1396
|
-
|
|
1525
|
+
z4.object({ type: z4.literal("automation"), executionId: z4.string().min(1) })
|
|
1397
1526
|
]);
|
|
1398
|
-
var sendChatMessageRequestSchema =
|
|
1399
|
-
messageId:
|
|
1400
|
-
submittedAt:
|
|
1401
|
-
message:
|
|
1402
|
-
model:
|
|
1403
|
-
customInstructions:
|
|
1404
|
-
planMode:
|
|
1405
|
-
images:
|
|
1406
|
-
type:
|
|
1407
|
-
source:
|
|
1408
|
-
|
|
1409
|
-
|
|
1527
|
+
var sendChatMessageRequestSchema = z4.object({
|
|
1528
|
+
messageId: z4.string().min(1).optional(),
|
|
1529
|
+
submittedAt: z4.string().datetime().optional(),
|
|
1530
|
+
message: z4.string().min(1),
|
|
1531
|
+
model: z4.string().optional(),
|
|
1532
|
+
customInstructions: z4.string().optional(),
|
|
1533
|
+
planMode: z4.boolean().optional(),
|
|
1534
|
+
images: z4.array(z4.object({
|
|
1535
|
+
type: z4.literal("image"),
|
|
1536
|
+
source: z4.discriminatedUnion("type", [
|
|
1537
|
+
z4.object({ type: z4.literal("base64"), media_type: z4.enum(IMAGE_MEDIA_TYPES), data: z4.string().min(1) }),
|
|
1538
|
+
z4.object({ type: z4.literal("url"), url: z4.string().url() })
|
|
1410
1539
|
])
|
|
1411
1540
|
})).optional(),
|
|
1412
|
-
canvasUploadIds:
|
|
1413
|
-
thinkingLevel:
|
|
1414
|
-
goalMode:
|
|
1415
|
-
fastMode:
|
|
1416
|
-
ultrafastMode:
|
|
1417
|
-
source:
|
|
1418
|
-
enableInteractiveTools:
|
|
1419
|
-
type:
|
|
1420
|
-
merge:
|
|
1421
|
-
idempotencyKey:
|
|
1422
|
-
automationId:
|
|
1423
|
-
environmentId:
|
|
1424
|
-
senderUserId:
|
|
1425
|
-
senderEmail:
|
|
1426
|
-
senderDisplayName:
|
|
1427
|
-
senderAvatarUrl:
|
|
1541
|
+
canvasUploadIds: z4.array(z4.string().min(1)).optional(),
|
|
1542
|
+
thinkingLevel: z4.enum(VALID_THINKING_LEVELS).optional(),
|
|
1543
|
+
goalMode: z4.boolean().optional(),
|
|
1544
|
+
fastMode: z4.boolean().optional(),
|
|
1545
|
+
ultrafastMode: z4.boolean().optional(),
|
|
1546
|
+
source: z4.enum(MESSAGE_SOURCES).optional(),
|
|
1547
|
+
enableInteractiveTools: z4.boolean().optional(),
|
|
1548
|
+
type: z4.string().min(1).optional(),
|
|
1549
|
+
merge: z4.boolean().optional(),
|
|
1550
|
+
idempotencyKey: z4.string().min(1).max(128).optional(),
|
|
1551
|
+
automationId: z4.string().optional(),
|
|
1552
|
+
environmentId: z4.string().min(1).optional(),
|
|
1553
|
+
senderUserId: z4.string().optional(),
|
|
1554
|
+
senderEmail: z4.string().optional(),
|
|
1555
|
+
senderDisplayName: z4.string().optional(),
|
|
1556
|
+
senderAvatarUrl: z4.string().optional(),
|
|
1428
1557
|
errorNotificationTarget: integrationErrorNotificationTargetSchema.optional(),
|
|
1429
|
-
errorNotificationTargets:
|
|
1430
|
-
streamSlackActivity:
|
|
1558
|
+
errorNotificationTargets: z4.array(integrationErrorNotificationTargetSchema).optional(),
|
|
1559
|
+
streamSlackActivity: z4.boolean().optional()
|
|
1431
1560
|
}).passthrough();
|
|
1432
1561
|
function isChatMessageSender(value) {
|
|
1433
1562
|
return isRecord(value) && (value.messageId === void 0 || typeof value.messageId === "string") && typeof value.senderUserId === "string" && typeof value.senderEmail === "string" && typeof value.recordedAt === "string";
|
|
@@ -1683,60 +1812,60 @@ function isSubagentMcpServerName(server) {
|
|
|
1683
1812
|
}
|
|
1684
1813
|
|
|
1685
1814
|
// ../shared/src/workspace-identity.ts
|
|
1686
|
-
import { z as
|
|
1815
|
+
import { z as z5 } from "zod";
|
|
1687
1816
|
var WORKSPACE_IDENTITY_AUDIENCE = "replicas:workspace";
|
|
1688
1817
|
var AWS_SOURCE_IDENTITY_CLAIM = "https://aws.amazon.com/source_identity";
|
|
1689
1818
|
var WORKSPACE_TOKEN_TTL_SECONDS = 15 * 60;
|
|
1690
1819
|
var IDENTITY_PROXY_PORT = 17323;
|
|
1691
1820
|
var IDENTITY_TOKEN_PATH = "/token";
|
|
1692
|
-
var workspaceAudienceSchema =
|
|
1693
|
-
var workspaceTokenRequestSchema =
|
|
1821
|
+
var workspaceAudienceSchema = z5.string().min(1).max(255).regex(/^[\x21-\x7e]+$/, "Audience must be a single printable token without spaces");
|
|
1822
|
+
var workspaceTokenRequestSchema = z5.object({
|
|
1694
1823
|
audience: workspaceAudienceSchema.optional(),
|
|
1695
|
-
aws_source_identity:
|
|
1824
|
+
aws_source_identity: z5.boolean().optional()
|
|
1696
1825
|
});
|
|
1697
|
-
var workspaceTokenClaimsSchema =
|
|
1698
|
-
iss:
|
|
1699
|
-
sub:
|
|
1700
|
-
aud:
|
|
1701
|
-
iat:
|
|
1702
|
-
nbf:
|
|
1703
|
-
exp:
|
|
1704
|
-
jti:
|
|
1705
|
-
organization_id:
|
|
1706
|
-
workspace_id:
|
|
1707
|
-
environment_id:
|
|
1708
|
-
creator_id:
|
|
1709
|
-
creator_email:
|
|
1710
|
-
[AWS_SOURCE_IDENTITY_CLAIM]:
|
|
1826
|
+
var workspaceTokenClaimsSchema = z5.object({
|
|
1827
|
+
iss: z5.string(),
|
|
1828
|
+
sub: z5.string(),
|
|
1829
|
+
aud: z5.string(),
|
|
1830
|
+
iat: z5.number().int(),
|
|
1831
|
+
nbf: z5.number().int(),
|
|
1832
|
+
exp: z5.number().int(),
|
|
1833
|
+
jti: z5.string(),
|
|
1834
|
+
organization_id: z5.string().uuid(),
|
|
1835
|
+
workspace_id: z5.string().uuid(),
|
|
1836
|
+
environment_id: z5.string().uuid(),
|
|
1837
|
+
creator_id: z5.string().uuid().nullable(),
|
|
1838
|
+
creator_email: z5.string().nullable().default(null),
|
|
1839
|
+
[AWS_SOURCE_IDENTITY_CLAIM]: z5.string().uuid().optional()
|
|
1711
1840
|
}).passthrough();
|
|
1712
|
-
var workspaceTokenResponseSchema =
|
|
1713
|
-
issuer:
|
|
1714
|
-
audience:
|
|
1715
|
-
token:
|
|
1716
|
-
expires_at:
|
|
1841
|
+
var workspaceTokenResponseSchema = z5.object({
|
|
1842
|
+
issuer: z5.string(),
|
|
1843
|
+
audience: z5.string(),
|
|
1844
|
+
token: z5.string(),
|
|
1845
|
+
expires_at: z5.string()
|
|
1717
1846
|
});
|
|
1718
|
-
var legacyWorkspaceTokenBundleSchema =
|
|
1719
|
-
version:
|
|
1720
|
-
issuer:
|
|
1721
|
-
default_audience:
|
|
1722
|
-
tokens:
|
|
1847
|
+
var legacyWorkspaceTokenBundleSchema = z5.object({
|
|
1848
|
+
version: z5.literal(1),
|
|
1849
|
+
issuer: z5.string(),
|
|
1850
|
+
default_audience: z5.string(),
|
|
1851
|
+
tokens: z5.record(z5.string(), z5.object({ token: z5.string(), expires_at: z5.string() }))
|
|
1723
1852
|
});
|
|
1724
|
-
var mcpWorkloadAuthSchema =
|
|
1725
|
-
type:
|
|
1853
|
+
var mcpWorkloadAuthSchema = z5.strictObject({
|
|
1854
|
+
type: z5.literal("workspace_identity"),
|
|
1726
1855
|
audience: workspaceAudienceSchema
|
|
1727
1856
|
});
|
|
1728
|
-
var mcpAuthSchema =
|
|
1857
|
+
var mcpAuthSchema = z5.discriminatedUnion("type", [
|
|
1729
1858
|
mcpWorkloadAuthSchema,
|
|
1730
|
-
|
|
1859
|
+
z5.strictObject({ type: z5.literal("oauth") })
|
|
1731
1860
|
]);
|
|
1732
|
-
var engineMcpOAuthTokenRequestSchema =
|
|
1733
|
-
environment_mcp_id:
|
|
1734
|
-
force_refresh:
|
|
1861
|
+
var engineMcpOAuthTokenRequestSchema = z5.object({
|
|
1862
|
+
environment_mcp_id: z5.string().uuid(),
|
|
1863
|
+
force_refresh: z5.boolean().optional()
|
|
1735
1864
|
});
|
|
1736
|
-
var engineMcpOAuthTokenResponseSchema =
|
|
1737
|
-
url:
|
|
1738
|
-
access_token:
|
|
1739
|
-
expires_at:
|
|
1865
|
+
var engineMcpOAuthTokenResponseSchema = z5.object({
|
|
1866
|
+
url: z5.string(),
|
|
1867
|
+
access_token: z5.string(),
|
|
1868
|
+
expires_at: z5.string().nullable()
|
|
1740
1869
|
});
|
|
1741
1870
|
|
|
1742
1871
|
// ../shared/src/runtime-env.ts
|
|
@@ -1810,20 +1939,6 @@ function parsePosixEnvFile(content) {
|
|
|
1810
1939
|
return result;
|
|
1811
1940
|
}
|
|
1812
1941
|
|
|
1813
|
-
// ../shared/src/github/url.ts
|
|
1814
|
-
var GITHUB_HOST_RE = /(^|@|\/\/)github\.com[:/]/;
|
|
1815
|
-
var GITHUB_REPO_SLUG_RE = /github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?(?:[/?#]|$)/i;
|
|
1816
|
-
function isGitHubUrl(url) {
|
|
1817
|
-
if (!url) return false;
|
|
1818
|
-
return GITHUB_HOST_RE.test(url);
|
|
1819
|
-
}
|
|
1820
|
-
function parseRepoUrlSlug(url) {
|
|
1821
|
-
if (!url) return null;
|
|
1822
|
-
const match = url.match(GITHUB_REPO_SLUG_RE);
|
|
1823
|
-
if (!match) return null;
|
|
1824
|
-
return { owner: match[1].toLowerCase(), repo: match[2].toLowerCase() };
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
1942
|
// ../shared/src/git.ts
|
|
1828
1943
|
var GIT_CREDENTIAL_HELPER_FILENAME = ".git-credential-replicas";
|
|
1829
1944
|
var GITHUB_CREDENTIAL_REFRESH_PATH = "/git-credentials/github/refresh";
|
|
@@ -1942,19 +2057,19 @@ function gitIdentityConfigCommands(identity, scope = "global") {
|
|
|
1942
2057
|
}
|
|
1943
2058
|
|
|
1944
2059
|
// ../shared/src/headless-agent.ts
|
|
1945
|
-
import { z as
|
|
1946
|
-
var headlessAgentRequestSchema =
|
|
1947
|
-
mode:
|
|
1948
|
-
agent:
|
|
2060
|
+
import { z as z6 } from "zod";
|
|
2061
|
+
var headlessAgentRequestSchema = z6.object({
|
|
2062
|
+
mode: z6.literal("structured"),
|
|
2063
|
+
agent: z6.custom(
|
|
1949
2064
|
(value) => typeof value === "string" && isValidAgentProvider(value)
|
|
1950
2065
|
),
|
|
1951
|
-
model:
|
|
1952
|
-
prompt:
|
|
1953
|
-
workingDirectory:
|
|
1954
|
-
timeoutSeconds:
|
|
1955
|
-
thinkingLevel:
|
|
1956
|
-
codexOauthTokens:
|
|
1957
|
-
outputSchema:
|
|
2066
|
+
model: z6.string().min(1),
|
|
2067
|
+
prompt: z6.string(),
|
|
2068
|
+
workingDirectory: z6.string().min(1),
|
|
2069
|
+
timeoutSeconds: z6.number().int().min(1).max(1800).default(300),
|
|
2070
|
+
thinkingLevel: z6.enum(STANDARD_THINKING_LEVELS).optional(),
|
|
2071
|
+
codexOauthTokens: z6.object({ accessToken: z6.string(), accountId: z6.string() }).optional(),
|
|
2072
|
+
outputSchema: z6.record(z6.string(), z6.json())
|
|
1958
2073
|
});
|
|
1959
2074
|
var headlessAgentUsagePath = (outputPath) => `${outputPath}.usage`;
|
|
1960
2075
|
|
|
@@ -2016,8 +2131,8 @@ var RATE_LIMIT_PATTERNS = [
|
|
|
2016
2131
|
];
|
|
2017
2132
|
var HTTP_429_PATTERN = /(?:^|[^0-9])429(?:$|[^0-9])/;
|
|
2018
2133
|
var HTTP_CONTEXT_PATTERN = /(api error|request|response|status|http)/;
|
|
2019
|
-
function detectAgentQuotaLimit(
|
|
2020
|
-
const normalized =
|
|
2134
|
+
function detectAgentQuotaLimit(text3) {
|
|
2135
|
+
const normalized = text3.toLowerCase();
|
|
2021
2136
|
if (!normalized) return null;
|
|
2022
2137
|
if (OUT_OF_CREDITS_PATTERNS.some((pattern) => pattern.test(normalized))) return "out_of_credits";
|
|
2023
2138
|
if (RATE_LIMIT_PATTERNS.some((pattern) => pattern.test(normalized))) return "rate_limit";
|
|
@@ -2050,12 +2165,12 @@ function describeAuthFallback(payload) {
|
|
|
2050
2165
|
}
|
|
2051
2166
|
|
|
2052
2167
|
// ../shared/src/workspace-credentials.ts
|
|
2053
|
-
import { z as
|
|
2168
|
+
import { z as z7 } from "zod";
|
|
2054
2169
|
var WORKSPACE_CREDENTIAL_PROVIDERS = ["claude", "codex"];
|
|
2055
|
-
var workspaceCredentialProviderSchema =
|
|
2170
|
+
var workspaceCredentialProviderSchema = z7.enum(WORKSPACE_CREDENTIAL_PROVIDERS);
|
|
2056
2171
|
var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true, credentialId: true });
|
|
2057
2172
|
var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
|
|
2058
|
-
provider:
|
|
2173
|
+
provider: z7.enum(VALID_AGENT_PROVIDERS)
|
|
2059
2174
|
}).refine(({ provider: provider2, method }) => agentCredentialMethods(provider2).includes(method), {
|
|
2060
2175
|
message: "This inference provider is not supported by this agent"
|
|
2061
2176
|
});
|
|
@@ -2066,59 +2181,59 @@ var switchWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend(
|
|
|
2066
2181
|
});
|
|
2067
2182
|
|
|
2068
2183
|
// ../shared/src/chat-fork.ts
|
|
2069
|
-
import { z as
|
|
2184
|
+
import { z as z9 } from "zod";
|
|
2070
2185
|
|
|
2071
2186
|
// ../shared/src/fallback-chains.ts
|
|
2072
|
-
import { z as
|
|
2073
|
-
var fallbackHarnessStepSchema =
|
|
2074
|
-
kind:
|
|
2075
|
-
provider:
|
|
2076
|
-
model:
|
|
2077
|
-
thinkingLevel:
|
|
2187
|
+
import { z as z8 } from "zod";
|
|
2188
|
+
var fallbackHarnessStepSchema = z8.object({
|
|
2189
|
+
kind: z8.literal("harness"),
|
|
2190
|
+
provider: z8.enum(VALID_AGENT_PROVIDERS),
|
|
2191
|
+
model: z8.string().min(1),
|
|
2192
|
+
thinkingLevel: z8.enum(VALID_THINKING_LEVELS).optional()
|
|
2078
2193
|
});
|
|
2079
|
-
var fallbackPlanStepSchema =
|
|
2080
|
-
|
|
2081
|
-
kind:
|
|
2082
|
-
methods:
|
|
2083
|
-
models:
|
|
2194
|
+
var fallbackPlanStepSchema = z8.discriminatedUnion("kind", [
|
|
2195
|
+
z8.object({
|
|
2196
|
+
kind: z8.literal("credentials"),
|
|
2197
|
+
methods: z8.array(z8.custom(isAuthMethod)).min(1),
|
|
2198
|
+
models: z8.record(z8.string(), z8.string().min(1)).optional()
|
|
2084
2199
|
}),
|
|
2085
2200
|
fallbackHarnessStepSchema
|
|
2086
2201
|
]);
|
|
2087
|
-
var fallbackPlanResponseSchema =
|
|
2202
|
+
var fallbackPlanResponseSchema = z8.object({ steps: z8.array(fallbackPlanStepSchema) });
|
|
2088
2203
|
|
|
2089
2204
|
// ../shared/src/chat-fork.ts
|
|
2090
|
-
var quotaLimitKindSchema =
|
|
2091
|
-
var chatForkInfoSchema =
|
|
2092
|
-
source:
|
|
2093
|
-
chatId:
|
|
2094
|
-
provider:
|
|
2095
|
-
title:
|
|
2205
|
+
var quotaLimitKindSchema = z9.enum(["rate_limit", "out_of_credits"]);
|
|
2206
|
+
var chatForkInfoSchema = z9.object({
|
|
2207
|
+
source: z9.object({
|
|
2208
|
+
chatId: z9.string().min(1),
|
|
2209
|
+
provider: z9.enum(VALID_AGENT_PROVIDERS),
|
|
2210
|
+
title: z9.string()
|
|
2096
2211
|
}),
|
|
2097
|
-
trigger:
|
|
2212
|
+
trigger: z9.enum(["manual", "auto", "side"]),
|
|
2098
2213
|
reason: quotaLimitKindSchema.optional(),
|
|
2099
|
-
state:
|
|
2100
|
-
error:
|
|
2101
|
-
startedAt:
|
|
2102
|
-
completedAt:
|
|
2214
|
+
state: z9.enum(["preparing", "ready", "failed"]),
|
|
2215
|
+
error: z9.string().optional(),
|
|
2216
|
+
startedAt: z9.string(),
|
|
2217
|
+
completedAt: z9.string().optional()
|
|
2103
2218
|
});
|
|
2104
2219
|
function coerceChatForkInfo(value) {
|
|
2105
2220
|
const parsed = chatForkInfoSchema.safeParse(value);
|
|
2106
2221
|
return parsed.success ? parsed.data : null;
|
|
2107
2222
|
}
|
|
2108
|
-
var forkChatRequestSchema =
|
|
2109
|
-
provider:
|
|
2110
|
-
model:
|
|
2111
|
-
thinkingLevel:
|
|
2112
|
-
title:
|
|
2113
|
-
message:
|
|
2114
|
-
id:
|
|
2115
|
-
clientRequestId:
|
|
2116
|
-
enableInteractiveTools:
|
|
2223
|
+
var forkChatRequestSchema = z9.object({
|
|
2224
|
+
provider: z9.enum(VALID_AGENT_PROVIDERS),
|
|
2225
|
+
model: z9.string().min(1).optional(),
|
|
2226
|
+
thinkingLevel: z9.enum(VALID_THINKING_LEVELS).optional(),
|
|
2227
|
+
title: z9.string().min(1).max(200).optional(),
|
|
2228
|
+
message: z9.string().trim().optional(),
|
|
2229
|
+
id: z9.string().uuid().optional(),
|
|
2230
|
+
clientRequestId: z9.string().min(1).max(128).optional(),
|
|
2231
|
+
enableInteractiveTools: z9.boolean().optional(),
|
|
2117
2232
|
// Server-injected by the monolith from the authenticated request; never trusted from clients.
|
|
2118
|
-
senderUserId:
|
|
2119
|
-
senderEmail:
|
|
2120
|
-
senderDisplayName:
|
|
2121
|
-
senderAvatarUrl:
|
|
2233
|
+
senderUserId: z9.string().optional(),
|
|
2234
|
+
senderEmail: z9.string().optional(),
|
|
2235
|
+
senderDisplayName: z9.string().optional(),
|
|
2236
|
+
senderAvatarUrl: z9.string().optional()
|
|
2122
2237
|
});
|
|
2123
2238
|
function describeQuotaLimit(reason) {
|
|
2124
2239
|
return reason === "out_of_credits" ? "ran out of credits" : "hit its usage limit";
|
|
@@ -2127,10 +2242,10 @@ function describeChatForkReason(reason, provider2) {
|
|
|
2127
2242
|
return reason ? `${getProviderDisplayName(provider2)} ${describeQuotaLimit(reason)}` : null;
|
|
2128
2243
|
}
|
|
2129
2244
|
var AGENT_QUOTA_EXHAUSTED_EVENT_TYPE = "agent-quota-exhausted";
|
|
2130
|
-
var agentQuotaExhaustedPayloadSchema =
|
|
2131
|
-
provider:
|
|
2245
|
+
var agentQuotaExhaustedPayloadSchema = z9.object({
|
|
2246
|
+
provider: z9.enum(VALID_AGENT_PROVIDERS),
|
|
2132
2247
|
reason: quotaLimitKindSchema,
|
|
2133
|
-
detail:
|
|
2248
|
+
detail: z9.string().optional(),
|
|
2134
2249
|
forkTo: fallbackHarnessStepSchema.optional()
|
|
2135
2250
|
});
|
|
2136
2251
|
function defaultForkChatTitle(source, provider2) {
|
|
@@ -2138,10 +2253,10 @@ function defaultForkChatTitle(source, provider2) {
|
|
|
2138
2253
|
}
|
|
2139
2254
|
|
|
2140
2255
|
// ../shared/src/credential-pool.ts
|
|
2141
|
-
import { z as
|
|
2256
|
+
import { z as z10 } from "zod";
|
|
2142
2257
|
var MAX_CREDENTIAL_POOL_ACCOUNTS = 10;
|
|
2143
|
-
var reorderCredentialPoolSchema =
|
|
2144
|
-
credential_ids:
|
|
2258
|
+
var reorderCredentialPoolSchema = z10.object({
|
|
2259
|
+
credential_ids: z10.array(z10.string().uuid()).min(1).max(MAX_CREDENTIAL_POOL_ACCOUNTS)
|
|
2145
2260
|
});
|
|
2146
2261
|
|
|
2147
2262
|
// ../shared/src/display-message/types.ts
|
|
@@ -2277,8 +2392,8 @@ function indexOrEnd(src, search, from) {
|
|
|
2277
2392
|
const index = src.indexOf(search, from);
|
|
2278
2393
|
return index < 0 ? src.length : index;
|
|
2279
2394
|
}
|
|
2280
|
-
function decodeAnsiC(
|
|
2281
|
-
return
|
|
2395
|
+
function decodeAnsiC(text3) {
|
|
2396
|
+
return text3.replace(/\\(x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{1,4}|[0-7]{1,3}|[\s\S])/g, (_match, escape) => {
|
|
2282
2397
|
if (escape[0] === "x" || escape[0] === "u") return String.fromCharCode(parseInt(escape.slice(1), 16));
|
|
2283
2398
|
if (/^[0-7]/.test(escape)) return String.fromCharCode(parseInt(escape, 8));
|
|
2284
2399
|
return ANSI_C_ESCAPES[escape] ?? escape;
|
|
@@ -2295,8 +2410,8 @@ function staticOutput(argv, stdin) {
|
|
|
2295
2410
|
if (flags.includes("n")) newline = false;
|
|
2296
2411
|
if (flags.includes("e")) escapes = true;
|
|
2297
2412
|
}
|
|
2298
|
-
const
|
|
2299
|
-
return (escapes ? decodeAnsiC(
|
|
2413
|
+
const text3 = args.join(" ");
|
|
2414
|
+
return (escapes ? decodeAnsiC(text3) : text3) + (newline ? "\n" : "");
|
|
2300
2415
|
}
|
|
2301
2416
|
if (name === "printf" && args.length > 0) {
|
|
2302
2417
|
const format = decodeAnsiC(args[0]);
|
|
@@ -2456,8 +2571,8 @@ function parseUntil(scope, start, closeParen) {
|
|
|
2456
2571
|
let quoted = false;
|
|
2457
2572
|
let redirect = null;
|
|
2458
2573
|
let parens = 0;
|
|
2459
|
-
const append = (
|
|
2460
|
-
word = (word ?? "") +
|
|
2574
|
+
const append = (text3, isQuoted = false) => {
|
|
2575
|
+
word = (word ?? "") + text3;
|
|
2461
2576
|
quoted ||= isQuoted;
|
|
2462
2577
|
};
|
|
2463
2578
|
const endWord = () => {
|
|
@@ -2653,10 +2768,10 @@ function planItemsFromMessage(message2) {
|
|
|
2653
2768
|
if (!todos) return null;
|
|
2654
2769
|
return todos.flatMap((todo) => {
|
|
2655
2770
|
if (!todo || typeof todo !== "object") return [];
|
|
2656
|
-
const
|
|
2771
|
+
const text3 = "content" in todo && typeof todo.content === "string" ? todo.content : "text" in todo && typeof todo.text === "string" ? todo.text : null;
|
|
2657
2772
|
const status = "status" in todo ? todo.status : null;
|
|
2658
|
-
if (!
|
|
2659
|
-
return [{ text:
|
|
2773
|
+
if (!text3) return [];
|
|
2774
|
+
return [{ text: text3, status: status === "completed" || status === "in_progress" ? status : "pending" }];
|
|
2660
2775
|
});
|
|
2661
2776
|
}
|
|
2662
2777
|
function getDisplayMessageStatus(message2) {
|
|
@@ -2960,110 +3075,13 @@ function subagentChatId(message2) {
|
|
|
2960
3075
|
}
|
|
2961
3076
|
|
|
2962
3077
|
// ../shared/src/multitask-events.ts
|
|
2963
|
-
import { z as
|
|
2964
|
-
|
|
2965
|
-
// ../shared/src/urls.ts
|
|
2966
|
-
var DASHBOARD_PATH = "/dashboard";
|
|
2967
|
-
var WEB_APP_PATHS = {
|
|
2968
|
-
home: "/",
|
|
2969
|
-
onboarding: "/onboarding",
|
|
2970
|
-
workspaces: "/workspace",
|
|
2971
|
-
environmentSetup: "/workspace/setup",
|
|
2972
|
-
automations: "/automations",
|
|
2973
|
-
environment: "/environment",
|
|
2974
|
-
analytics: "/analytics",
|
|
2975
|
-
dashboard: DASHBOARD_PATH,
|
|
2976
|
-
agents: `${DASHBOARD_PATH}/agents`,
|
|
2977
|
-
integrations: `${DASHBOARD_PATH}/integrations`,
|
|
2978
|
-
integrationsGithub: `${DASHBOARD_PATH}/integrations/github`,
|
|
2979
|
-
integrationsGitlab: `${DASHBOARD_PATH}/integrations/gitlab`,
|
|
2980
|
-
settings: `${DASHBOARD_PATH}/settings`,
|
|
2981
|
-
billing: `${DASHBOARD_PATH}/billing`,
|
|
2982
|
-
members: `${DASHBOARD_PATH}/members`,
|
|
2983
|
-
learnings: `${DASHBOARD_PATH}/learnings`,
|
|
2984
|
-
"audit-logs": `${DASHBOARD_PATH}/audit-logs`,
|
|
2985
|
-
accountAgents: `${DASHBOARD_PATH}/account/agents`,
|
|
2986
|
-
accountProfile: `${DASHBOARD_PATH}/account/profile`,
|
|
2987
|
-
accountConnections: `${DASHBOARD_PATH}/account/connections`,
|
|
2988
|
-
accountIntegrations: `${DASHBOARD_PATH}/account/integrations`,
|
|
2989
|
-
accountApiKeys: `${DASHBOARD_PATH}/account/api-keys`,
|
|
2990
|
-
accountPreferences: `${DASHBOARD_PATH}/account/preferences`,
|
|
2991
|
-
fullscreenWorkspaces: "/workspaces"
|
|
2992
|
-
};
|
|
2993
|
-
var LEGACY_WEB_APP_PATHS = {
|
|
2994
|
-
app: "/app",
|
|
2995
|
-
home: "/home",
|
|
2996
|
-
dashboardWorkspaces: `${DASHBOARD_PATH}/workspaces`
|
|
2997
|
-
};
|
|
2998
|
-
var PR_URL_REGEX = /github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/;
|
|
2999
|
-
function parsePrUrl(url) {
|
|
3000
|
-
const match = url.match(PR_URL_REGEX);
|
|
3001
|
-
if (!match) return null;
|
|
3002
|
-
const [, owner, repo, numberStr] = match;
|
|
3003
|
-
const number = Number.parseInt(numberStr, 10);
|
|
3004
|
-
if (!Number.isFinite(number)) return null;
|
|
3005
|
-
return { owner, repo, number };
|
|
3006
|
-
}
|
|
3007
|
-
function parseCodeHostPrUrl(url) {
|
|
3008
|
-
const github = parsePrUrl(url);
|
|
3009
|
-
if (github) {
|
|
3010
|
-
return {
|
|
3011
|
-
...github,
|
|
3012
|
-
provider: "github",
|
|
3013
|
-
host: "github.com",
|
|
3014
|
-
repositoryPath: `${github.owner}/${github.repo}`,
|
|
3015
|
-
repoUrl: `https://github.com/${github.owner}/${github.repo}`
|
|
3016
|
-
};
|
|
3017
|
-
}
|
|
3018
|
-
let parsed;
|
|
3019
|
-
try {
|
|
3020
|
-
parsed = new URL(url);
|
|
3021
|
-
} catch {
|
|
3022
|
-
return null;
|
|
3023
|
-
}
|
|
3024
|
-
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
|
|
3025
|
-
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
3026
|
-
const separatorIndex = segments.indexOf("-");
|
|
3027
|
-
if (separatorIndex <= 0 || segments[separatorIndex + 1] !== "merge_requests") return null;
|
|
3028
|
-
const number = Number.parseInt(segments[separatorIndex + 2] ?? "", 10);
|
|
3029
|
-
if (!Number.isFinite(number)) return null;
|
|
3030
|
-
const repositorySegments = decodePathSegments(segments.slice(0, separatorIndex));
|
|
3031
|
-
const repo = repositorySegments[repositorySegments.length - 1];
|
|
3032
|
-
const owner = repositorySegments[0];
|
|
3033
|
-
if (!owner || !repo) return null;
|
|
3034
|
-
const repositoryPath = repositorySegments.join("/");
|
|
3035
|
-
return {
|
|
3036
|
-
provider: "gitlab",
|
|
3037
|
-
host: parsed.host.toLowerCase(),
|
|
3038
|
-
owner,
|
|
3039
|
-
repo,
|
|
3040
|
-
number,
|
|
3041
|
-
repositoryPath,
|
|
3042
|
-
repoUrl: `${parsed.origin}/${repositoryPath}`
|
|
3043
|
-
};
|
|
3044
|
-
}
|
|
3045
|
-
function decodePathSegments(segments) {
|
|
3046
|
-
return segments.map((segment) => {
|
|
3047
|
-
try {
|
|
3048
|
-
return decodeURIComponent(segment);
|
|
3049
|
-
} catch {
|
|
3050
|
-
return segment;
|
|
3051
|
-
}
|
|
3052
|
-
});
|
|
3053
|
-
}
|
|
3054
|
-
function buildCodeHostPrUrl(repoUrl, provider2, prNumber) {
|
|
3055
|
-
const normalizedRepoUrl = repoUrl.replace(/\.git$/, "");
|
|
3056
|
-
if (provider2 === "gitlab") {
|
|
3057
|
-
return `${normalizedRepoUrl}/-/merge_requests/${prNumber}`;
|
|
3058
|
-
}
|
|
3059
|
-
return `${normalizedRepoUrl}/pull/${prNumber}`;
|
|
3060
|
-
}
|
|
3078
|
+
import { z as z16 } from "zod";
|
|
3061
3079
|
|
|
3062
3080
|
// ../shared/src/replicas-mcp.ts
|
|
3063
|
-
import { z as
|
|
3081
|
+
import { z as z15 } from "zod";
|
|
3064
3082
|
|
|
3065
3083
|
// ../shared/src/automations/trigger-schemas.ts
|
|
3066
|
-
import { z as
|
|
3084
|
+
import { z as z11 } from "zod";
|
|
3067
3085
|
|
|
3068
3086
|
// ../shared/src/uuid.ts
|
|
3069
3087
|
function createUuidFromHex(value) {
|
|
@@ -3080,47 +3098,47 @@ function getReviewerLoginsError(event, logins) {
|
|
|
3080
3098
|
if (isReviewRequested === !!logins?.some((login) => login.trim().replace(/^@+/, ""))) return null;
|
|
3081
3099
|
return isReviewRequested ? "The PR review requested trigger needs at least one GitHub username" : "Requested reviewers only apply to the PR review requested trigger";
|
|
3082
3100
|
}
|
|
3083
|
-
var repositoryTriggerConfigSchema =
|
|
3084
|
-
event:
|
|
3085
|
-
repository_ids:
|
|
3086
|
-
group_pr_events:
|
|
3087
|
-
excluded_actors:
|
|
3088
|
-
reviewer_logins:
|
|
3101
|
+
var repositoryTriggerConfigSchema = z11.object({
|
|
3102
|
+
event: z11.string(),
|
|
3103
|
+
repository_ids: z11.array(z11.string().regex(UUID_RE, "must be a repository id")).optional(),
|
|
3104
|
+
group_pr_events: z11.boolean().optional(),
|
|
3105
|
+
excluded_actors: z11.array(z11.string()).optional(),
|
|
3106
|
+
reviewer_logins: z11.array(z11.string()).optional()
|
|
3089
3107
|
});
|
|
3090
|
-
var cronTriggerSchema =
|
|
3091
|
-
var githubTriggerSchema =
|
|
3092
|
-
type:
|
|
3108
|
+
var cronTriggerSchema = z11.object({ type: z11.literal("cron"), config: z11.object({ schedule: z11.string(), timezone: z11.string().optional() }) });
|
|
3109
|
+
var githubTriggerSchema = z11.object({
|
|
3110
|
+
type: z11.literal("github"),
|
|
3093
3111
|
config: repositoryTriggerConfigSchema.superRefine((config, ctx) => {
|
|
3094
3112
|
const message2 = getReviewerLoginsError(config.event, config.reviewer_logins);
|
|
3095
3113
|
if (message2) ctx.addIssue({ code: "custom", message: message2, path: ["reviewer_logins"] });
|
|
3096
3114
|
})
|
|
3097
3115
|
});
|
|
3098
|
-
var gitlabTriggerSchema =
|
|
3099
|
-
var automationTriggerSchema =
|
|
3116
|
+
var gitlabTriggerSchema = z11.object({ type: z11.literal("gitlab"), config: repositoryTriggerConfigSchema });
|
|
3117
|
+
var automationTriggerSchema = z11.discriminatedUnion("type", [
|
|
3100
3118
|
cronTriggerSchema,
|
|
3101
3119
|
githubTriggerSchema,
|
|
3102
3120
|
gitlabTriggerSchema,
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3121
|
+
z11.object({ type: z11.literal("slack"), config: z11.object({ event: z11.string(), channel_ids: z11.array(z11.string()).optional(), group_thread_replies: z11.boolean().optional() }) }),
|
|
3122
|
+
z11.object({ type: z11.literal("sentry"), config: z11.object({ event: z11.string(), project_slugs: z11.array(z11.string()).optional(), min_level: z11.string().optional() }) }),
|
|
3123
|
+
z11.object({ type: z11.literal("custom"), config: z11.object({}) })
|
|
3106
3124
|
]);
|
|
3107
3125
|
|
|
3108
3126
|
// ../shared/src/routes/environment.ts
|
|
3109
|
-
import { z as
|
|
3127
|
+
import { z as z12 } from "zod";
|
|
3110
3128
|
var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
|
|
3111
|
-
var stringMap =
|
|
3112
|
-
var createEnvironmentMcpRequestSchema =
|
|
3113
|
-
name:
|
|
3114
|
-
transport:
|
|
3115
|
-
config:
|
|
3116
|
-
|
|
3117
|
-
|
|
3129
|
+
var stringMap = z12.record(z12.string(), z12.string());
|
|
3130
|
+
var createEnvironmentMcpRequestSchema = z12.object({
|
|
3131
|
+
name: z12.string(),
|
|
3132
|
+
transport: z12.enum(ENVIRONMENT_MCP_TRANSPORTS),
|
|
3133
|
+
config: z12.union([
|
|
3134
|
+
z12.object({ command: z12.string().min(1), args: z12.array(z12.string()).optional(), env: stringMap.optional() }),
|
|
3135
|
+
z12.object({ url: z12.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
|
|
3118
3136
|
]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
|
|
3119
3137
|
});
|
|
3120
3138
|
var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
|
|
3121
3139
|
|
|
3122
3140
|
// ../shared/src/routes/workspaces.ts
|
|
3123
|
-
import { z as
|
|
3141
|
+
import { z as z14 } from "zod";
|
|
3124
3142
|
|
|
3125
3143
|
// ../shared/src/default-skills/replicas-agent/abilities/computer.ts
|
|
3126
3144
|
var SECTION = `### Computer use (Linux desktop control)
|
|
@@ -3392,7 +3410,7 @@ var DOCKER_ABILITY = {
|
|
|
3392
3410
|
};
|
|
3393
3411
|
|
|
3394
3412
|
// ../shared/src/routes/environment-setups.ts
|
|
3395
|
-
import { z as
|
|
3413
|
+
import { z as z13 } from "zod";
|
|
3396
3414
|
var ENVIRONMENT_SETUP_STEPS = [
|
|
3397
3415
|
{ key: "understand", label: "Understand the codebase" },
|
|
3398
3416
|
{ key: "install", label: "Install dependencies and run the app" },
|
|
@@ -3426,17 +3444,17 @@ var ENVIRONMENT_SETUP_LIMITS = {
|
|
|
3426
3444
|
};
|
|
3427
3445
|
var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
|
|
3428
3446
|
var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
3429
|
-
var
|
|
3430
|
-
var requiredText = (max) =>
|
|
3431
|
-
var
|
|
3432
|
-
var clearableText = (max) =>
|
|
3433
|
-
var list = (item, max) => max === void 0 ?
|
|
3447
|
+
var text2 = (max) => max === void 0 ? z13.string().trim() : z13.string().trim().max(max);
|
|
3448
|
+
var requiredText = (max) => text2(max).min(1, "must not be empty");
|
|
3449
|
+
var optionalText2 = (max) => text2(max).nullish().transform((value) => value || null);
|
|
3450
|
+
var clearableText = (max) => text2(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
|
|
3451
|
+
var list = (item, max) => max === void 0 ? z13.array(item) : z13.array(item).max(max);
|
|
3434
3452
|
var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
|
|
3435
3453
|
function isEnvironmentSetupAuthoredTriggerType(type) {
|
|
3436
3454
|
return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
|
|
3437
3455
|
}
|
|
3438
|
-
var proposalTriggerSchema =
|
|
3439
|
-
var existingTriggerSchema =
|
|
3456
|
+
var proposalTriggerSchema = z13.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
|
|
3457
|
+
var existingTriggerSchema = z13.custom(
|
|
3440
3458
|
(value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
|
|
3441
3459
|
"must be an automation trigger"
|
|
3442
3460
|
);
|
|
@@ -3444,22 +3462,22 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
|
|
|
3444
3462
|
(trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
|
|
3445
3463
|
);
|
|
3446
3464
|
function automationSchema(limits) {
|
|
3447
|
-
const authored =
|
|
3448
|
-
name:
|
|
3449
|
-
description:
|
|
3450
|
-
prompt:
|
|
3465
|
+
const authored = z13.object({
|
|
3466
|
+
name: text2(limits.nameChars),
|
|
3467
|
+
description: text2(limits.descriptionChars),
|
|
3468
|
+
prompt: text2(limits.automationPromptChars),
|
|
3451
3469
|
triggers: list(proposalTriggerSchema, limits.automationTriggers)
|
|
3452
3470
|
});
|
|
3453
|
-
const updated = authored.extend({ triggers: list(
|
|
3454
|
-
return
|
|
3471
|
+
const updated = authored.extend({ triggers: list(z13.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
|
|
3472
|
+
return z13.object({
|
|
3455
3473
|
key: requiredText(limits.automationKeyChars),
|
|
3456
|
-
action:
|
|
3457
|
-
automation_id:
|
|
3458
|
-
name:
|
|
3459
|
-
description:
|
|
3460
|
-
prompt:
|
|
3474
|
+
action: z13.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
|
|
3475
|
+
automation_id: z13.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
|
|
3476
|
+
name: text2().default(""),
|
|
3477
|
+
description: optionalText2().transform((value) => value ?? ""),
|
|
3478
|
+
prompt: text2().default(""),
|
|
3461
3479
|
triggers: list(existingTriggerSchema).default([]),
|
|
3462
|
-
note:
|
|
3480
|
+
note: optionalText2(limits.automationNoteChars)
|
|
3463
3481
|
}).superRefine((automation, ctx) => {
|
|
3464
3482
|
if (automation.action === "create" && automation.automation_id) {
|
|
3465
3483
|
ctx.addIssue({ code: "custom", path: ["automation_id"], message: "belongs on an update, keep, or disable entry" });
|
|
@@ -3477,7 +3495,7 @@ function automationSchema(limits) {
|
|
|
3477
3495
|
const content = (automation.action === "update" ? updated : authored).safeParse(automation);
|
|
3478
3496
|
if (content.success) return { ...automation, ...content.data };
|
|
3479
3497
|
for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
|
|
3480
|
-
return
|
|
3498
|
+
return z13.NEVER;
|
|
3481
3499
|
});
|
|
3482
3500
|
}
|
|
3483
3501
|
function automationListSchema(limits) {
|
|
@@ -3495,8 +3513,8 @@ function automationListSchema(limits) {
|
|
|
3495
3513
|
});
|
|
3496
3514
|
}
|
|
3497
3515
|
function environmentSchema(limits) {
|
|
3498
|
-
return
|
|
3499
|
-
name:
|
|
3516
|
+
return z13.object({
|
|
3517
|
+
name: optionalText2(limits.nameChars).transform((value) => value ?? void 0),
|
|
3500
3518
|
description: clearableText(limits.descriptionChars),
|
|
3501
3519
|
system_prompt: clearableText(limits.systemPromptChars),
|
|
3502
3520
|
start_hook: clearableText(limits.hookChars),
|
|
@@ -3504,26 +3522,26 @@ function environmentSchema(limits) {
|
|
|
3504
3522
|
});
|
|
3505
3523
|
}
|
|
3506
3524
|
function variableSchema(limits, requiredDefault) {
|
|
3507
|
-
return
|
|
3508
|
-
key:
|
|
3509
|
-
description:
|
|
3510
|
-
required:
|
|
3525
|
+
return z13.object({
|
|
3526
|
+
key: z13.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
|
|
3527
|
+
description: optionalText2(limits.variableDescriptionChars).transform((value) => value ?? ""),
|
|
3528
|
+
required: z13.boolean().default(requiredDefault)
|
|
3511
3529
|
});
|
|
3512
3530
|
}
|
|
3513
3531
|
function proposalSchema(limits) {
|
|
3514
|
-
return
|
|
3532
|
+
return z13.object({
|
|
3515
3533
|
summary: requiredText(limits.summaryChars),
|
|
3516
|
-
stack: list(
|
|
3534
|
+
stack: list(text2(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
|
|
3517
3535
|
environment: environmentSchema(limits),
|
|
3518
3536
|
variables: list(variableSchema(limits, false), limits.variables).default([]),
|
|
3519
3537
|
automations: automationListSchema(limits),
|
|
3520
|
-
verification: list(
|
|
3538
|
+
verification: list(z13.object({
|
|
3521
3539
|
label: requiredText(limits.nameChars),
|
|
3522
|
-
status:
|
|
3523
|
-
detail:
|
|
3540
|
+
status: z13.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
|
|
3541
|
+
detail: optionalText2(limits.verificationDetailChars).transform((value) => value ?? void 0)
|
|
3524
3542
|
}), limits.verificationItems).default([]),
|
|
3525
|
-
media: list(
|
|
3526
|
-
media_id:
|
|
3543
|
+
media: list(z13.object({
|
|
3544
|
+
media_id: z13.string().regex(UUID_RE, "must be a media id"),
|
|
3527
3545
|
title: requiredText(limits.nameChars)
|
|
3528
3546
|
}), limits.mediaItems).default([])
|
|
3529
3547
|
});
|
|
@@ -3531,35 +3549,35 @@ function proposalSchema(limits) {
|
|
|
3531
3549
|
var environmentSetupProposalSchema = proposalSchema({});
|
|
3532
3550
|
var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
|
|
3533
3551
|
var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
|
|
3534
|
-
status:
|
|
3535
|
-
requested_at:
|
|
3536
|
-
resolved_at:
|
|
3552
|
+
status: z13.enum(["pending", "provided", "skipped"]),
|
|
3553
|
+
requested_at: z13.string(),
|
|
3554
|
+
resolved_at: z13.string().nullable().default(null)
|
|
3537
3555
|
});
|
|
3538
|
-
var environmentSetupRunStateSchema =
|
|
3539
|
-
status:
|
|
3540
|
-
steps:
|
|
3556
|
+
var environmentSetupRunStateSchema = z13.object({
|
|
3557
|
+
status: z13.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
|
|
3558
|
+
steps: z13.partialRecord(z13.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z13.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
|
|
3541
3559
|
proposal: environmentSetupProposalSchema.nullable().default(null),
|
|
3542
|
-
applied:
|
|
3543
|
-
applied_at:
|
|
3544
|
-
automation_ids:
|
|
3560
|
+
applied: z13.object({
|
|
3561
|
+
applied_at: z13.string(),
|
|
3562
|
+
automation_ids: z13.array(z13.string())
|
|
3545
3563
|
}).nullable().default(null),
|
|
3546
|
-
variable_requests:
|
|
3564
|
+
variable_requests: z13.array(environmentSetupVariableRequestSchema).default([])
|
|
3547
3565
|
});
|
|
3548
|
-
var applyEnvironmentSetupRequestSchema =
|
|
3566
|
+
var applyEnvironmentSetupRequestSchema = z13.object({
|
|
3549
3567
|
environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
|
|
3550
|
-
variables: list(
|
|
3568
|
+
variables: list(z13.object({ key: z13.string().regex(VARIABLE_KEY_RE), value: z13.string() }), ENVIRONMENT_SETUP_LIMITS.variables).default([]).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys").transform((variables) => variables.filter((variable) => variable.value.length > 0)),
|
|
3551
3569
|
automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
|
|
3552
3570
|
});
|
|
3553
|
-
var requestEnvironmentSetupVariablesSchema =
|
|
3571
|
+
var requestEnvironmentSetupVariablesSchema = z13.object({
|
|
3554
3572
|
variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
|
|
3555
3573
|
}).superRefine(({ variables }, ctx) => {
|
|
3556
3574
|
if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
|
|
3557
3575
|
ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
|
|
3558
3576
|
}
|
|
3559
3577
|
});
|
|
3560
|
-
var respondEnvironmentSetupVariablesSchema =
|
|
3561
|
-
values:
|
|
3562
|
-
skipped:
|
|
3578
|
+
var respondEnvironmentSetupVariablesSchema = z13.object({
|
|
3579
|
+
values: z13.record(z13.string().regex(VARIABLE_KEY_RE), z13.string()).default({}),
|
|
3580
|
+
skipped: z13.array(z13.string().regex(VARIABLE_KEY_RE)).default([])
|
|
3563
3581
|
});
|
|
3564
3582
|
|
|
3565
3583
|
// ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
|
|
@@ -5297,16 +5315,16 @@ var DEFAULT_WORKSPACE_FILTERS = {
|
|
|
5297
5315
|
activity: "any"
|
|
5298
5316
|
};
|
|
5299
5317
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
5300
|
-
var workspaceExecRequestSchema =
|
|
5301
|
-
command:
|
|
5302
|
-
timeout_seconds:
|
|
5318
|
+
var workspaceExecRequestSchema = z14.object({
|
|
5319
|
+
command: z14.string().regex(/\S/, "command is required"),
|
|
5320
|
+
timeout_seconds: z14.number().int().min(1).max(50).optional().describe("Default: 30")
|
|
5303
5321
|
});
|
|
5304
|
-
var terminalRtcCandidateSchema =
|
|
5305
|
-
var terminalSocketServerMessageSchema =
|
|
5306
|
-
|
|
5307
|
-
|
|
5322
|
+
var terminalRtcCandidateSchema = z14.object({ type: z14.literal("rtc-candidate"), candidate: z14.string(), mid: z14.string() });
|
|
5323
|
+
var terminalSocketServerMessageSchema = z14.discriminatedUnion("type", [
|
|
5324
|
+
z14.object({ type: z14.literal("output"), data: z14.string() }),
|
|
5325
|
+
z14.object({ type: z14.literal("rtc-answer"), sdp: z14.string() }),
|
|
5308
5326
|
terminalRtcCandidateSchema,
|
|
5309
|
-
|
|
5327
|
+
z14.object({ type: z14.literal("rtc-switch") })
|
|
5310
5328
|
]);
|
|
5311
5329
|
var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
|
|
5312
5330
|
|
|
@@ -5331,41 +5349,41 @@ var REPLICAS_MCP_TOOLS = {
|
|
|
5331
5349
|
archiveSubagent: "archive_subagent",
|
|
5332
5350
|
waitForSubagents: "wait_for_subagents"
|
|
5333
5351
|
};
|
|
5334
|
-
var automationToolInputSchema =
|
|
5335
|
-
name:
|
|
5336
|
-
prompt:
|
|
5337
|
-
environment_id:
|
|
5338
|
-
triggers:
|
|
5352
|
+
var automationToolInputSchema = z15.object({
|
|
5353
|
+
name: z15.string().describe("Short automation name."),
|
|
5354
|
+
prompt: z15.string().describe("Prompt each automation run starts with."),
|
|
5355
|
+
environment_id: z15.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
|
|
5356
|
+
triggers: z15.array(automationTriggerSchema).min(1).describe(
|
|
5339
5357
|
'One or more triggers. Cron: `{ "type": "cron", "config": { "schedule": "0 9 * * 1", "timezone": "America/New_York" } }`. GitHub: `{ "type": "github", "config": { "event": "pull_request.opened", "repository_ids": ["<repository uuid>"] } }`.'
|
|
5340
5358
|
),
|
|
5341
|
-
description:
|
|
5342
|
-
plan_mode:
|
|
5343
|
-
goal_mode:
|
|
5344
|
-
fast_mode:
|
|
5359
|
+
description: z15.string().optional().describe("One-line summary shown in the dashboard."),
|
|
5360
|
+
plan_mode: z15.boolean().optional(),
|
|
5361
|
+
goal_mode: z15.boolean().optional(),
|
|
5362
|
+
fast_mode: z15.boolean().optional()
|
|
5345
5363
|
});
|
|
5346
5364
|
var automationCreateToolInputSchema = automationToolInputSchema.extend({
|
|
5347
|
-
scope:
|
|
5365
|
+
scope: z15.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
|
|
5348
5366
|
});
|
|
5349
5367
|
var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
|
|
5350
|
-
automation_id:
|
|
5351
|
-
enabled:
|
|
5352
|
-
agent_provider:
|
|
5353
|
-
model:
|
|
5354
|
-
thinking_level:
|
|
5355
|
-
workspace_lifecycle_policy:
|
|
5356
|
-
workspace_size:
|
|
5368
|
+
automation_id: z15.string().describe("Automation ID"),
|
|
5369
|
+
enabled: z15.boolean().optional(),
|
|
5370
|
+
agent_provider: z15.enum(AGENT).nullable().optional(),
|
|
5371
|
+
model: z15.string().nullable().optional(),
|
|
5372
|
+
thinking_level: z15.enum(VALID_THINKING_LEVELS).nullable().optional(),
|
|
5373
|
+
workspace_lifecycle_policy: z15.enum(VALID_LIFECYCLE_POLICIES).optional(),
|
|
5374
|
+
workspace_size: z15.enum(WORKSPACE_SIZES).optional()
|
|
5357
5375
|
});
|
|
5358
|
-
var chatPath = { id:
|
|
5376
|
+
var chatPath = { id: z15.string().describe("Workspace ID"), chat_id: z15.string().describe("Chat ID") };
|
|
5359
5377
|
var { provider, model, thinkingLevel, title, message } = forkChatRequestSchema.shape;
|
|
5360
|
-
var createChatToolInputSchema =
|
|
5361
|
-
var forkChatToolInputSchema =
|
|
5362
|
-
var renameChatToolInputSchema =
|
|
5363
|
-
var runCommandToolInputSchema =
|
|
5364
|
-
var environmentMcpPath = { environment_id:
|
|
5365
|
-
var createEnvironmentMcpToolInputSchema =
|
|
5366
|
-
var updateEnvironmentMcpToolInputSchema =
|
|
5378
|
+
var createChatToolInputSchema = z15.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
|
|
5379
|
+
var forkChatToolInputSchema = z15.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
|
|
5380
|
+
var renameChatToolInputSchema = z15.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
|
|
5381
|
+
var runCommandToolInputSchema = z15.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
|
|
5382
|
+
var environmentMcpPath = { environment_id: z15.string().describe("Environment ID") };
|
|
5383
|
+
var createEnvironmentMcpToolInputSchema = z15.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
|
|
5384
|
+
var updateEnvironmentMcpToolInputSchema = z15.object({
|
|
5367
5385
|
...environmentMcpPath,
|
|
5368
|
-
mcp_id:
|
|
5386
|
+
mcp_id: z15.string().describe("MCP ID"),
|
|
5369
5387
|
...updateEnvironmentMcpRequestSchema.shape
|
|
5370
5388
|
});
|
|
5371
5389
|
|
|
@@ -5431,12 +5449,12 @@ function wrapInTag(content, tag) {
|
|
|
5431
5449
|
${content}
|
|
5432
5450
|
</${tag}>`;
|
|
5433
5451
|
}
|
|
5434
|
-
function removeTag(
|
|
5452
|
+
function removeTag(text3, tag) {
|
|
5435
5453
|
const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
|
|
5436
|
-
return
|
|
5454
|
+
return text3.replace(regex, "").trim();
|
|
5437
5455
|
}
|
|
5438
|
-
function removeReplicasInstructions(
|
|
5439
|
-
return removeTag(
|
|
5456
|
+
function removeReplicasInstructions(text3) {
|
|
5457
|
+
return removeTag(text3, REPLICAS_INSTRUCTIONS_TAG);
|
|
5440
5458
|
}
|
|
5441
5459
|
var MULTITASK_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MULTITASK_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MULTITASK_INSTRUCTIONS_TAG}>`);
|
|
5442
5460
|
function splitMultitaskInstructions(customInstructions) {
|
|
@@ -5450,23 +5468,23 @@ function splitMultitaskInstructions(customInstructions) {
|
|
|
5450
5468
|
// ../shared/src/multitask-events.ts
|
|
5451
5469
|
var MULTITASK_EVENT_KINDS = ["finished", "ready", "needs_attention", "merged", "closed", "archived"];
|
|
5452
5470
|
var MULTITASK_EVENT_TYPE = "multitask-event";
|
|
5453
|
-
var multitaskEventSchema =
|
|
5454
|
-
id:
|
|
5455
|
-
at:
|
|
5456
|
-
kind:
|
|
5457
|
-
agentId:
|
|
5458
|
-
agentName:
|
|
5459
|
-
summary:
|
|
5460
|
-
detail:
|
|
5471
|
+
var multitaskEventSchema = z16.object({
|
|
5472
|
+
id: z16.string(),
|
|
5473
|
+
at: z16.string(),
|
|
5474
|
+
kind: z16.enum(MULTITASK_EVENT_KINDS),
|
|
5475
|
+
agentId: z16.string(),
|
|
5476
|
+
agentName: z16.string(),
|
|
5477
|
+
summary: z16.string(),
|
|
5478
|
+
detail: z16.string().optional(),
|
|
5461
5479
|
// Already shown as a row when it happened, so the delivered message does not show it again.
|
|
5462
|
-
noticed:
|
|
5480
|
+
noticed: z16.boolean().optional()
|
|
5463
5481
|
});
|
|
5464
5482
|
var TAG = "multitask_event";
|
|
5465
5483
|
var BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
|
|
5466
5484
|
var ATTRIBUTE = /(\w+)="([^"]*)"/g;
|
|
5467
5485
|
var unescapeAttribute = (value) => value.replace(/</g, "<").replace(/"/g, '"').replace(/&/g, "&");
|
|
5468
|
-
function extractMultitaskEvents(
|
|
5469
|
-
return [...
|
|
5486
|
+
function extractMultitaskEvents(text3) {
|
|
5487
|
+
return [...text3.matchAll(BLOCK)].flatMap((match) => {
|
|
5470
5488
|
const attributes = Object.fromEntries([...match[1].matchAll(ATTRIBUTE)].map(([, key, value]) => [key, unescapeAttribute(value)]));
|
|
5471
5489
|
const kind = MULTITASK_EVENT_KINDS.find((candidate) => candidate === attributes.kind);
|
|
5472
5490
|
if (!kind || !attributes.id || !attributes.agent_id) return [];
|
|
@@ -5484,13 +5502,13 @@ function extractMultitaskEvents(text2) {
|
|
|
5484
5502
|
}];
|
|
5485
5503
|
});
|
|
5486
5504
|
}
|
|
5487
|
-
function parseMultitaskEvents(
|
|
5488
|
-
const events = extractMultitaskEvents(
|
|
5489
|
-
return events.length > 0 &&
|
|
5505
|
+
function parseMultitaskEvents(text3) {
|
|
5506
|
+
const events = extractMultitaskEvents(text3);
|
|
5507
|
+
return events.length > 0 && text3.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
|
|
5490
5508
|
}
|
|
5491
5509
|
|
|
5492
5510
|
// ../shared/src/learned-skills.ts
|
|
5493
|
-
import { z as
|
|
5511
|
+
import { z as z17 } from "zod";
|
|
5494
5512
|
|
|
5495
5513
|
// ../shared/src/frontmatter.ts
|
|
5496
5514
|
import { parse as parseYaml } from "yaml";
|
|
@@ -5513,20 +5531,20 @@ function parseFrontmatter(content) {
|
|
|
5513
5531
|
var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
|
|
5514
5532
|
var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
|
|
5515
5533
|
var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
|
|
5516
|
-
var learnedSkillsManifestSchema =
|
|
5517
|
-
skills:
|
|
5534
|
+
var learnedSkillsManifestSchema = z17.object({
|
|
5535
|
+
skills: z17.array(z17.object({ name: z17.string(), sha256: z17.string() }))
|
|
5518
5536
|
});
|
|
5519
|
-
var dreamVerdictChecksSchema =
|
|
5520
|
-
repeatable:
|
|
5521
|
-
realInstruction:
|
|
5522
|
-
noContradiction:
|
|
5523
|
-
formatExact:
|
|
5524
|
-
humanOnly:
|
|
5525
|
-
actionable:
|
|
5526
|
-
durable:
|
|
5537
|
+
var dreamVerdictChecksSchema = z17.object({
|
|
5538
|
+
repeatable: z17.boolean(),
|
|
5539
|
+
realInstruction: z17.boolean(),
|
|
5540
|
+
noContradiction: z17.boolean(),
|
|
5541
|
+
formatExact: z17.boolean(),
|
|
5542
|
+
humanOnly: z17.boolean(),
|
|
5543
|
+
actionable: z17.boolean(),
|
|
5544
|
+
durable: z17.boolean()
|
|
5527
5545
|
});
|
|
5528
5546
|
var DREAM_VERDICT_CHECKS = dreamVerdictChecksSchema.keyof().options;
|
|
5529
|
-
var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve:
|
|
5547
|
+
var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z17.boolean(), reason: z17.string() });
|
|
5530
5548
|
var learnedSkillFormatInstruction = (speaker) => `Write a SKILL.md whose frontmatter has a kebab-case \`name\` and a short \`description\` that starts with "Use when" and names the situations it applies to; the body records only what ${speaker} actually said, restated as a direct instruction, usually one to three lines. Every line of a learning is loaded into future sessions, so leave out anything an agent could infer on its own: no headings, explanations, rules, or examples unless ${speaker} stated those specifics themselves. For "from now on, use Conventional Commits", the body is just "Use Conventional Commits for every commit message and PR title."`;
|
|
5531
5549
|
|
|
5532
5550
|
// ../shared/src/user-message-matching.ts
|
|
@@ -5774,9 +5792,9 @@ function describeToolCall(message2, base) {
|
|
|
5774
5792
|
var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
5775
5793
|
var WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
|
|
5776
5794
|
var TRUNCATED_WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]*)(?:" duration_seconds="(\d*))?(?:" audio="(true)?)?[^<]*(?:<\/?[a-z_]*)?$/;
|
|
5777
|
-
function stripAttachmentNote(
|
|
5778
|
-
const match =
|
|
5779
|
-
let content = match ?
|
|
5795
|
+
function stripAttachmentNote(text3) {
|
|
5796
|
+
const match = text3.match(/(?:^|\n\n)<replicas_attachments>\nUploaded files are available at:((?:\n- .*)*)(?:\n<\/?[a-z_]*>?)?$/) ?? text3.match(/(?:^|\n\n)Uploaded files are available at:((?:\n- .*)*)$/);
|
|
5797
|
+
let content = match ? text3.replace(match[0], "").trim() : text3;
|
|
5780
5798
|
const walkthroughs = [];
|
|
5781
5799
|
const truncated = WALKTHROUGH_NOTE_REGEX.test(content) ? null : content.match(TRUNCATED_WALKTHROUGH_NOTE_REGEX);
|
|
5782
5800
|
if (truncated) {
|
|
@@ -5835,7 +5853,7 @@ function messagesForCodexTurn(turn) {
|
|
|
5835
5853
|
return [{
|
|
5836
5854
|
type: "reasoning",
|
|
5837
5855
|
id: turn.id,
|
|
5838
|
-
text: reasoning.map(({ text:
|
|
5856
|
+
text: reasoning.map(({ text: text3 }) => text3.trim()).join("\n\n"),
|
|
5839
5857
|
timestamp: reasoning[0].timestamp,
|
|
5840
5858
|
status: reasoning.at(-1)?.status ?? "completed"
|
|
5841
5859
|
}];
|
|
@@ -6312,8 +6330,8 @@ function getCursorAssistantText(event) {
|
|
|
6312
6330
|
return getTextContent(message2?.content);
|
|
6313
6331
|
}
|
|
6314
6332
|
function getCursorThinkingText(event) {
|
|
6315
|
-
const
|
|
6316
|
-
if (typeof
|
|
6333
|
+
const text3 = event.payload.text;
|
|
6334
|
+
if (typeof text3 === "string") return text3;
|
|
6317
6335
|
const message2 = isRecord(event.payload.message) ? event.payload.message : null;
|
|
6318
6336
|
return typeof message2?.text === "string" ? message2.text : "";
|
|
6319
6337
|
}
|
|
@@ -6364,8 +6382,8 @@ function parseCursorEvents(events) {
|
|
|
6364
6382
|
continue;
|
|
6365
6383
|
}
|
|
6366
6384
|
if (event.type === "cursor-assistant") {
|
|
6367
|
-
const
|
|
6368
|
-
if (
|
|
6385
|
+
const text3 = getCursorAssistantText(event);
|
|
6386
|
+
if (text3) {
|
|
6369
6387
|
const runId = cursorRunId(event);
|
|
6370
6388
|
if (!activeAssistant || activeAssistant.runId !== runId) {
|
|
6371
6389
|
const segment = runAssistantSegments.get(runId) ?? 0;
|
|
@@ -6384,15 +6402,15 @@ function parseCursorEvents(events) {
|
|
|
6384
6402
|
if (message2?.type === "agent") {
|
|
6385
6403
|
messages[activeAssistant.index] = {
|
|
6386
6404
|
...message2,
|
|
6387
|
-
content: `${message2.content}${
|
|
6405
|
+
content: `${message2.content}${text3}`
|
|
6388
6406
|
};
|
|
6389
6407
|
}
|
|
6390
6408
|
}
|
|
6391
6409
|
continue;
|
|
6392
6410
|
}
|
|
6393
6411
|
if (event.type === "cursor-thinking") {
|
|
6394
|
-
const
|
|
6395
|
-
if (
|
|
6412
|
+
const text3 = getCursorThinkingText(event);
|
|
6413
|
+
if (text3.trim()) {
|
|
6396
6414
|
const runId = cursorRunId(event);
|
|
6397
6415
|
if (!activeThinking || activeThinking.runId !== runId) {
|
|
6398
6416
|
const segment = runThinkingSegments.get(runId) ?? 0;
|
|
@@ -6412,7 +6430,7 @@ function parseCursorEvents(events) {
|
|
|
6412
6430
|
if (message2?.type === "reasoning") {
|
|
6413
6431
|
messages[activeThinking.index] = {
|
|
6414
6432
|
...message2,
|
|
6415
|
-
content: `${message2.content}${
|
|
6433
|
+
content: `${message2.content}${text3}`,
|
|
6416
6434
|
status: "in_progress"
|
|
6417
6435
|
};
|
|
6418
6436
|
}
|
|
@@ -6444,12 +6462,12 @@ function parseCursorEvents(events) {
|
|
|
6444
6462
|
}
|
|
6445
6463
|
if (event.type === "cursor-task") {
|
|
6446
6464
|
activeAssistant = null;
|
|
6447
|
-
const
|
|
6448
|
-
if (typeof
|
|
6465
|
+
const text3 = event.payload.text;
|
|
6466
|
+
if (typeof text3 === "string" && text3.trim()) {
|
|
6449
6467
|
messages.push({
|
|
6450
6468
|
id: `cursor-task-${event.timestamp}-${messages.length}`,
|
|
6451
6469
|
type: "agent",
|
|
6452
|
-
content:
|
|
6470
|
+
content: text3,
|
|
6453
6471
|
timestamp: event.timestamp
|
|
6454
6472
|
});
|
|
6455
6473
|
}
|
|
@@ -6535,8 +6553,8 @@ function extractErrorText(error) {
|
|
|
6535
6553
|
collect(error);
|
|
6536
6554
|
return parts.filter(Boolean).join("\n");
|
|
6537
6555
|
}
|
|
6538
|
-
function isTransientErrorText(
|
|
6539
|
-
const normalized =
|
|
6556
|
+
function isTransientErrorText(text3, options = {}) {
|
|
6557
|
+
const normalized = text3.toLowerCase();
|
|
6540
6558
|
if (!normalized) return false;
|
|
6541
6559
|
if (TRANSIENT_NETWORK_ERROR_PATTERNS.some((pattern) => pattern.test(normalized))) return true;
|
|
6542
6560
|
if (options.includeRateLimit && /rate limit/.test(normalized)) return true;
|
|
@@ -6659,24 +6677,24 @@ function parseOpencodeEvents(events) {
|
|
|
6659
6677
|
const time = isRecord(part.time) ? part.time : null;
|
|
6660
6678
|
const timestamp = timestampFromMs(time?.start, event.timestamp);
|
|
6661
6679
|
if (part.type === "text") {
|
|
6662
|
-
const
|
|
6663
|
-
if (
|
|
6680
|
+
const text3 = typeof part.text === "string" ? part.text : "";
|
|
6681
|
+
if (text3.trim()) {
|
|
6664
6682
|
upsertDisplayMessage(messages, {
|
|
6665
6683
|
id,
|
|
6666
6684
|
type: "agent",
|
|
6667
|
-
content:
|
|
6685
|
+
content: text3,
|
|
6668
6686
|
timestamp
|
|
6669
6687
|
});
|
|
6670
6688
|
}
|
|
6671
6689
|
continue;
|
|
6672
6690
|
}
|
|
6673
6691
|
if (part.type === "reasoning") {
|
|
6674
|
-
const
|
|
6675
|
-
if (
|
|
6692
|
+
const text3 = typeof part.text === "string" ? part.text : "";
|
|
6693
|
+
if (text3.trim()) {
|
|
6676
6694
|
upsertDisplayMessage(messages, {
|
|
6677
6695
|
id,
|
|
6678
6696
|
type: "reasoning",
|
|
6679
|
-
content:
|
|
6697
|
+
content: text3,
|
|
6680
6698
|
status: time?.end ? "completed" : "in_progress",
|
|
6681
6699
|
timestamp
|
|
6682
6700
|
});
|
|
@@ -6844,7 +6862,7 @@ function assistantErrorMessage(value) {
|
|
|
6844
6862
|
}
|
|
6845
6863
|
function parsePiEvents(events) {
|
|
6846
6864
|
const messages = [];
|
|
6847
|
-
const
|
|
6865
|
+
const text3 = /* @__PURE__ */ new Map();
|
|
6848
6866
|
const thinking = /* @__PURE__ */ new Map();
|
|
6849
6867
|
let activeMessageId = "assistant";
|
|
6850
6868
|
for (const event of events) {
|
|
@@ -6875,9 +6893,9 @@ function parsePiEvents(events) {
|
|
|
6875
6893
|
if (event.type === "pi-message_update") {
|
|
6876
6894
|
const payload = nestedPayload(event);
|
|
6877
6895
|
const id = typeof payload.id === "string" ? payload.id : activeMessageId;
|
|
6878
|
-
if (payload.type === "text_delta" && typeof payload.delta === "string")
|
|
6896
|
+
if (payload.type === "text_delta" && typeof payload.delta === "string") text3.set(id, `${text3.get(id) ?? ""}${payload.delta}`);
|
|
6879
6897
|
if (payload.type === "thinking_delta" && typeof payload.delta === "string") thinking.set(id, `${thinking.get(id) ?? ""}${payload.delta}`);
|
|
6880
|
-
const textContent =
|
|
6898
|
+
const textContent = text3.get(id);
|
|
6881
6899
|
const thinkingContent = thinking.get(id);
|
|
6882
6900
|
if (textContent !== void 0) upsertDisplayMessage(messages, { id: `pi-${id}`, type: "agent", content: textContent, timestamp: event.timestamp });
|
|
6883
6901
|
if (thinkingContent !== void 0) upsertDisplayMessage(messages, { id: `pi-thinking-${id}`, type: "reasoning", content: thinkingContent, status: "in_progress", timestamp: event.timestamp });
|
|
@@ -7896,7 +7914,7 @@ var SECRET_PATTERNS = [
|
|
|
7896
7914
|
/\b[A-Z][A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD)\s*=\s*[^\s]{12,}/g
|
|
7897
7915
|
];
|
|
7898
7916
|
function redactSecrets(value) {
|
|
7899
|
-
return SECRET_PATTERNS.reduce((
|
|
7917
|
+
return SECRET_PATTERNS.reduce((text3, pattern) => text3.replace(pattern, "[REDACTED]"), value);
|
|
7900
7918
|
}
|
|
7901
7919
|
|
|
7902
7920
|
// ../shared/src/transcript-canonicalize.ts
|
|
@@ -8441,24 +8459,24 @@ function clampWarmHookTimeoutMs(timeoutMs) {
|
|
|
8441
8459
|
}
|
|
8442
8460
|
return Math.min(timeoutMs, MAX_WARM_HOOK_TIMEOUT_MS);
|
|
8443
8461
|
}
|
|
8444
|
-
function buildOutputPreview(
|
|
8462
|
+
function buildOutputPreview(text3, {
|
|
8445
8463
|
maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS,
|
|
8446
8464
|
truncateFrom = "head",
|
|
8447
8465
|
marker = "\n...[truncated \u2014 download the full log to see the rest]"
|
|
8448
8466
|
} = {}) {
|
|
8449
|
-
if (
|
|
8450
|
-
return { output:
|
|
8467
|
+
if (text3.length <= maxChars) {
|
|
8468
|
+
return { output: text3, outputTruncated: false, outputTotalChars: text3.length };
|
|
8451
8469
|
}
|
|
8452
8470
|
const previewChars = Math.max(0, maxChars - marker.length);
|
|
8453
|
-
const output = previewChars === 0 ? marker.slice(0, maxChars) : truncateFrom === "tail" ? `${marker}${
|
|
8471
|
+
const output = previewChars === 0 ? marker.slice(0, maxChars) : truncateFrom === "tail" ? `${marker}${text3.slice(-previewChars)}` : `${text3.slice(0, previewChars)}${marker}`;
|
|
8454
8472
|
return {
|
|
8455
8473
|
output,
|
|
8456
8474
|
outputTruncated: true,
|
|
8457
|
-
outputTotalChars:
|
|
8475
|
+
outputTotalChars: text3.length
|
|
8458
8476
|
};
|
|
8459
8477
|
}
|
|
8460
|
-
function buildHookOutputPreview(
|
|
8461
|
-
return buildOutputPreview(
|
|
8478
|
+
function buildHookOutputPreview(text3, maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS) {
|
|
8479
|
+
return buildOutputPreview(text3, { maxChars });
|
|
8462
8480
|
}
|
|
8463
8481
|
function parseWarmHookConfig(value, filename = "replicas.json") {
|
|
8464
8482
|
if (typeof value === "string") {
|
|
@@ -8549,14 +8567,14 @@ var AUTHENTICATION_ERROR_PATTERNS = [
|
|
|
8549
8567
|
/authentication error/,
|
|
8550
8568
|
/invalid api key/
|
|
8551
8569
|
];
|
|
8552
|
-
function isAuthenticationErrorText(
|
|
8553
|
-
const normalized =
|
|
8570
|
+
function isAuthenticationErrorText(text3, extraPatterns = []) {
|
|
8571
|
+
const normalized = text3.toLowerCase();
|
|
8554
8572
|
return AUTHENTICATION_ERROR_PATTERNS.some((pattern) => pattern.test(normalized)) || extraPatterns.some((pattern) => pattern.test(normalized));
|
|
8555
8573
|
}
|
|
8556
8574
|
|
|
8557
8575
|
// ../shared/src/claude-auth.ts
|
|
8558
|
-
function isClaudeAuthErrorText(
|
|
8559
|
-
const lower =
|
|
8576
|
+
function isClaudeAuthErrorText(text3) {
|
|
8577
|
+
const lower = text3.toLowerCase();
|
|
8560
8578
|
return lower.includes("failed to authenticate") || lower.includes("authentication_error") || lower.includes("authentication_failed") || lower.includes("authentication failed") || lower.includes("invalid authentication credentials") || lower.includes("not logged in") || lower.includes("please run /login") || lower.includes("401") && lower.includes("authentic");
|
|
8561
8579
|
}
|
|
8562
8580
|
|
|
@@ -8749,7 +8767,7 @@ var CLAUDE_AUTH_ENV_KEYS_BY_METHOD = {
|
|
|
8749
8767
|
};
|
|
8750
8768
|
|
|
8751
8769
|
// ../shared/src/routes/command-protection.ts
|
|
8752
|
-
import { z as
|
|
8770
|
+
import { z as z18 } from "zod";
|
|
8753
8771
|
|
|
8754
8772
|
// ../shared/src/git-invocations.ts
|
|
8755
8773
|
var COMMIT_VALUE_OPTIONS = /* @__PURE__ */ new Set(["message", "file", "trailer", "reuse-message", "reedit-message", "fixup", "squash", "template", "author", "date", "cleanup", "pathspec-from-file"]);
|
|
@@ -8840,27 +8858,27 @@ function findCheckoutTarget(args) {
|
|
|
8840
8858
|
}
|
|
8841
8859
|
|
|
8842
8860
|
// ../shared/src/routes/command-protection.ts
|
|
8843
|
-
var commandProtectionRepoStateSchema =
|
|
8844
|
-
branch:
|
|
8845
|
-
defaultBranch:
|
|
8846
|
-
pushBranch:
|
|
8847
|
-
pushConfig:
|
|
8848
|
-
headMessage:
|
|
8849
|
-
mergeInProgress:
|
|
8861
|
+
var commandProtectionRepoStateSchema = z18.object({
|
|
8862
|
+
branch: z18.string().nullable(),
|
|
8863
|
+
defaultBranch: z18.string().nullable(),
|
|
8864
|
+
pushBranch: z18.string().nullable(),
|
|
8865
|
+
pushConfig: z18.string().nullable(),
|
|
8866
|
+
headMessage: z18.string().nullable(),
|
|
8867
|
+
mergeInProgress: z18.boolean().optional()
|
|
8850
8868
|
});
|
|
8851
|
-
var commandProtectionEvaluateRequestSchema =
|
|
8852
|
-
provider:
|
|
8853
|
-
source:
|
|
8854
|
-
toolName:
|
|
8855
|
-
toolInput:
|
|
8856
|
-
command:
|
|
8857
|
-
cwd:
|
|
8858
|
-
toolUseId:
|
|
8869
|
+
var commandProtectionEvaluateRequestSchema = z18.object({
|
|
8870
|
+
provider: z18.enum(["claude", "codex", "cursor", "opencode", "pi"]),
|
|
8871
|
+
source: z18.enum(["claude_pre_tool_use", "codex_approval_request", "cursor_pre_tool_use", "opencode_pre_tool_use", "pi_tool_call"]),
|
|
8872
|
+
toolName: z18.string(),
|
|
8873
|
+
toolInput: z18.unknown(),
|
|
8874
|
+
command: z18.string().nullish(),
|
|
8875
|
+
cwd: z18.string().nullish(),
|
|
8876
|
+
toolUseId: z18.string().nullish(),
|
|
8859
8877
|
// Read by the engine before the command runs, keyed by absolute path, so the
|
|
8860
8878
|
// policy can see branches and commit messages the command text only references.
|
|
8861
|
-
gitContext:
|
|
8862
|
-
repos:
|
|
8863
|
-
messageFiles:
|
|
8879
|
+
gitContext: z18.object({
|
|
8880
|
+
repos: z18.record(z18.string(), commandProtectionRepoStateSchema),
|
|
8881
|
+
messageFiles: z18.record(z18.string(), z18.string())
|
|
8864
8882
|
}).optional()
|
|
8865
8883
|
});
|
|
8866
8884
|
var COMMAND_PROTECTION_COMMAND_KEYS = ["command", "cmd", "script", "query", "endpoint", "path", "url", "mutation"];
|
|
@@ -8873,8 +8891,8 @@ function stringifyCommandProtectionInput(value) {
|
|
|
8873
8891
|
return String(value);
|
|
8874
8892
|
}
|
|
8875
8893
|
}
|
|
8876
|
-
function normalizeCommandProtectionText(
|
|
8877
|
-
return
|
|
8894
|
+
function normalizeCommandProtectionText(text3) {
|
|
8895
|
+
return text3.replace(/\\\n/g, " ").replace(/\s+/g, " ").trim().toLowerCase();
|
|
8878
8896
|
}
|
|
8879
8897
|
function extractCommandProtectionCommandText(request, options = {}) {
|
|
8880
8898
|
if (request.command && request.command.trim()) return request.command;
|
|
@@ -8998,7 +9016,7 @@ function isPrMergeCommand(argv) {
|
|
|
8998
9016
|
const method = /(?:^|\s)(?:-X\s*|--method[\s=])(\w+)/i.exec(args.join(" "))?.[1];
|
|
8999
9017
|
return words[0] === "api" && method?.toUpperCase() === "PUT" && words.some((word) => /\/(?:pulls|merge_requests)\/[^/]+\/merge$/.test(word));
|
|
9000
9018
|
}
|
|
9001
|
-
var matchingChecks = (checks,
|
|
9019
|
+
var matchingChecks = (checks, text3) => checks.flatMap(([name, pattern]) => pattern.test(text3) ? [name] : []);
|
|
9002
9020
|
function executedText(commands, keepWord = () => true) {
|
|
9003
9021
|
return commands.filter(({ argv, wrapper, truncated }) => (!wrapper || truncated) && argv[0].split("/").pop() !== "git").map(({ argv, stdin }) => normalizeCommandProtectionText([...argv.filter(keepWord), stdin ?? ""].join(" ").replaceAll(SHELL_OPAQUE, " "))).join("\n");
|
|
9004
9022
|
}
|
|
@@ -9057,102 +9075,102 @@ function shouldRefreshPullRequests(toolName, toolInput) {
|
|
|
9057
9075
|
}
|
|
9058
9076
|
|
|
9059
9077
|
// ../shared/src/routes/linear.ts
|
|
9060
|
-
import { z as
|
|
9061
|
-
var linearSessionMetadataSchema =
|
|
9062
|
-
via_mothership:
|
|
9063
|
-
issue_id:
|
|
9064
|
-
issue_identifier:
|
|
9065
|
-
issue_title:
|
|
9066
|
-
issue_description:
|
|
9067
|
-
issue_url:
|
|
9068
|
-
comment_id:
|
|
9069
|
-
comment_body:
|
|
9070
|
-
triggered_by_id:
|
|
9071
|
-
triggered_by_name:
|
|
9072
|
-
triggered_by_email:
|
|
9073
|
-
linear_workspace_id:
|
|
9074
|
-
creator_id:
|
|
9075
|
-
creator_name:
|
|
9076
|
-
creator_email:
|
|
9077
|
-
assignee_id:
|
|
9078
|
-
assignee_name:
|
|
9079
|
-
assignee_email:
|
|
9080
|
-
issue_state:
|
|
9081
|
-
parent_issue:
|
|
9082
|
-
id:
|
|
9083
|
-
identifier:
|
|
9084
|
-
title:
|
|
9085
|
-
description:
|
|
9078
|
+
import { z as z19 } from "zod";
|
|
9079
|
+
var linearSessionMetadataSchema = z19.object({
|
|
9080
|
+
via_mothership: z19.boolean().optional(),
|
|
9081
|
+
issue_id: z19.string(),
|
|
9082
|
+
issue_identifier: z19.string(),
|
|
9083
|
+
issue_title: z19.string(),
|
|
9084
|
+
issue_description: z19.string(),
|
|
9085
|
+
issue_url: z19.string(),
|
|
9086
|
+
comment_id: z19.string(),
|
|
9087
|
+
comment_body: z19.string(),
|
|
9088
|
+
triggered_by_id: z19.string().optional(),
|
|
9089
|
+
triggered_by_name: z19.string().optional(),
|
|
9090
|
+
triggered_by_email: z19.string().optional(),
|
|
9091
|
+
linear_workspace_id: z19.string().optional(),
|
|
9092
|
+
creator_id: z19.string().optional(),
|
|
9093
|
+
creator_name: z19.string().optional(),
|
|
9094
|
+
creator_email: z19.string().optional(),
|
|
9095
|
+
assignee_id: z19.string().optional(),
|
|
9096
|
+
assignee_name: z19.string().optional(),
|
|
9097
|
+
assignee_email: z19.string().optional(),
|
|
9098
|
+
issue_state: z19.string().optional(),
|
|
9099
|
+
parent_issue: z19.object({
|
|
9100
|
+
id: z19.string(),
|
|
9101
|
+
identifier: z19.string(),
|
|
9102
|
+
title: z19.string(),
|
|
9103
|
+
description: z19.string().nullable()
|
|
9086
9104
|
}).optional(),
|
|
9087
|
-
workspace:
|
|
9088
|
-
id:
|
|
9089
|
-
coding_agent:
|
|
9090
|
-
task_description:
|
|
9091
|
-
created_at:
|
|
9105
|
+
workspace: z19.object({
|
|
9106
|
+
id: z19.string(),
|
|
9107
|
+
coding_agent: z19.custom((value) => typeof value === "string" && isValidAgentProvider(value)),
|
|
9108
|
+
task_description: z19.string(),
|
|
9109
|
+
created_at: z19.string()
|
|
9092
9110
|
}).optional()
|
|
9093
9111
|
});
|
|
9094
9112
|
|
|
9095
9113
|
// ../shared/src/routes/mothership.ts
|
|
9096
|
-
import { z as
|
|
9114
|
+
import { z as z20 } from "zod";
|
|
9097
9115
|
var MOTHERSHIP_LINEAR_ACTIONS = ["ask", "start"];
|
|
9098
|
-
var mothershipLinearSessionIntentRequestSchema =
|
|
9099
|
-
comment_id:
|
|
9100
|
-
action:
|
|
9116
|
+
var mothershipLinearSessionIntentRequestSchema = z20.object({
|
|
9117
|
+
comment_id: z20.string().trim().min(1).describe("Id of the Linear comment the session will be created on."),
|
|
9118
|
+
action: z20.enum(MOTHERSHIP_LINEAR_ACTIONS).describe("`ask` when the comment is a clarifying question, `start` when it is the complete task prompt.")
|
|
9101
9119
|
});
|
|
9102
|
-
var mothershipLinearStartRequestSchema =
|
|
9103
|
-
issue_id:
|
|
9104
|
-
agent_session_id:
|
|
9105
|
-
prompt:
|
|
9120
|
+
var mothershipLinearStartRequestSchema = z20.object({
|
|
9121
|
+
issue_id: z20.string().describe("Linear issue id from the envelope's `issue_id`."),
|
|
9122
|
+
agent_session_id: z20.string().describe("Existing Linear agent session id from the envelope's `agent_session_id`."),
|
|
9123
|
+
prompt: z20.string().trim().min(1).describe("Complete task prompt for the coding workspace.")
|
|
9106
9124
|
});
|
|
9107
|
-
var slackChannelIdSchema =
|
|
9108
|
-
var slackThreadTsSchema =
|
|
9109
|
-
var mothershipSlackSpawnRequestSchema =
|
|
9125
|
+
var slackChannelIdSchema = z20.string().describe("Slack channel id from the envelope's `channel_id`.");
|
|
9126
|
+
var slackThreadTsSchema = z20.string().describe("Slack thread timestamp from the envelope's `thread_ts`.");
|
|
9127
|
+
var mothershipSlackSpawnRequestSchema = z20.object({
|
|
9110
9128
|
channel_id: slackChannelIdSchema,
|
|
9111
9129
|
thread_ts: slackThreadTsSchema,
|
|
9112
|
-
message_ts:
|
|
9113
|
-
user_id:
|
|
9114
|
-
prompt:
|
|
9115
|
-
environment_id:
|
|
9130
|
+
message_ts: z20.string().describe("Timestamp of the Slack message that asked for the work (the envelope's `message_ts`). The server verifies this message and its author."),
|
|
9131
|
+
user_id: z20.string().describe("Slack user id of that message's author (the envelope's `user_id`). The workspace is attributed to them."),
|
|
9132
|
+
prompt: z20.string().describe("Complete task for the new workspace, written so it stands on its own."),
|
|
9133
|
+
environment_id: z20.string().optional().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`. Pass it only when clearly confident it fits; omit it to let routing choose. If routing cannot choose, the call fails and nothing is posted, so pick one or ask the person.`)
|
|
9116
9134
|
});
|
|
9117
|
-
var mothershipSlackRelayRequestSchema =
|
|
9135
|
+
var mothershipSlackRelayRequestSchema = z20.object({
|
|
9118
9136
|
channel_id: slackChannelIdSchema,
|
|
9119
9137
|
thread_ts: slackThreadTsSchema,
|
|
9120
|
-
message:
|
|
9121
|
-
user_id:
|
|
9122
|
-
queue:
|
|
9123
|
-
workspace_id:
|
|
9124
|
-
message_ts:
|
|
9138
|
+
message: z20.string().describe("The follow-up to deliver, combining every fresh message that belongs to this update."),
|
|
9139
|
+
user_id: z20.string().optional().describe("Slack user id of the follow-up's author (the envelope's `user_id`), so it is attributed to them. Defaults to the thread's original requester. Required with `workspace_id`."),
|
|
9140
|
+
queue: z20.boolean().optional().describe("Set true only when the person explicitly asked for this to happen after the current task finishes. Delivers behind the active turn instead of interrupting it."),
|
|
9141
|
+
workspace_id: z20.string().optional().describe(`Existing workspace id, from \`${REPLICAS_MCP_TOOLS.listWorkspaces}\` or a workspace link in the thread, to bind a thread without a workspace to before relaying. The author must be able to see it. Omit to relay into the thread's own workspace.`),
|
|
9142
|
+
message_ts: z20.string().optional().describe("Timestamp of the Slack message that led to this relay (the envelope's `message_ts`). Required with `workspace_id`; the server verifies this message and its author.")
|
|
9125
9143
|
});
|
|
9126
|
-
var mothershipListWorkspacesRequestSchema =
|
|
9144
|
+
var mothershipListWorkspacesRequestSchema = z20.object({
|
|
9127
9145
|
channel_id: slackChannelIdSchema,
|
|
9128
9146
|
thread_ts: slackThreadTsSchema,
|
|
9129
|
-
message_ts:
|
|
9130
|
-
user_id:
|
|
9131
|
-
query:
|
|
9147
|
+
message_ts: z20.string().describe("The envelope's `message_ts`. The server verifies this message and its author."),
|
|
9148
|
+
user_id: z20.string().describe("Slack user id of that message's author (the envelope's `user_id`). Only workspaces they can see are listed."),
|
|
9149
|
+
query: z20.string().trim().min(1).optional().describe("Case-insensitive text to match against workspace names and pull request URLs.")
|
|
9132
9150
|
});
|
|
9133
|
-
var mothershipSlackConfirmationSchema =
|
|
9134
|
-
confirmation_channel_id:
|
|
9135
|
-
confirmation_thread_ts:
|
|
9136
|
-
confirmation_message_ts:
|
|
9137
|
-
confirmation_user_id:
|
|
9151
|
+
var mothershipSlackConfirmationSchema = z20.object({
|
|
9152
|
+
confirmation_channel_id: z20.string().describe("`channel_id` from the envelope of the Slack message that asked for or accepted this."),
|
|
9153
|
+
confirmation_thread_ts: z20.string().describe("`thread_ts` from that message's envelope."),
|
|
9154
|
+
confirmation_message_ts: z20.string().describe("`message_ts` from that message's envelope."),
|
|
9155
|
+
confirmation_user_id: z20.string().describe("`user_id` from that message's envelope.")
|
|
9138
9156
|
});
|
|
9139
9157
|
var mothershipAutomationToolInputSchema = automationToolInputSchema.extend(mothershipSlackConfirmationSchema.shape);
|
|
9140
9158
|
var mothershipSaveChannelPresetToolInputSchema = mothershipSlackConfirmationSchema.extend({
|
|
9141
|
-
preset_id:
|
|
9142
|
-
name:
|
|
9143
|
-
description:
|
|
9144
|
-
icon:
|
|
9145
|
-
instructions:
|
|
9159
|
+
preset_id: z20.string().optional().describe(`Id of the preset to update, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`. Omit to create a new preset.`),
|
|
9160
|
+
name: z20.string().trim().min(1).max(MOTHERSHIP_PRESET_NAME_MAX_LENGTH).optional().describe("Preset name. Required when creating."),
|
|
9161
|
+
description: z20.string().optional().describe("One-line summary shown in settings."),
|
|
9162
|
+
icon: z20.enum(MOTHERSHIP_PRESET_ICONS).optional(),
|
|
9163
|
+
instructions: z20.string().optional().describe("Complete preset instructions; replaces the existing text. Required when creating.")
|
|
9146
9164
|
});
|
|
9147
9165
|
var mothershipUpdateChannelSettingsToolInputSchema = mothershipSlackConfirmationSchema.extend({
|
|
9148
|
-
source:
|
|
9149
|
-
external_id:
|
|
9150
|
-
monitored:
|
|
9151
|
-
preset_id:
|
|
9152
|
-
instructions:
|
|
9166
|
+
source: z20.enum(MOTHERSHIP_SOURCE_TYPES).optional().describe("Defaults to `slack`."),
|
|
9167
|
+
external_id: z20.string().describe("Slack channel id or Linear team id."),
|
|
9168
|
+
monitored: z20.boolean().optional().describe("`false` stops Mothership from handling the source: it excludes a Slack channel or stops monitoring a Linear team. `true` resumes a Slack channel or starts monitoring a Linear team, and only an organization admin can ask for that. Omit to keep it."),
|
|
9169
|
+
preset_id: z20.string().nullable().optional().describe("Preset to assign; `null` removes the preset. Omit to keep it."),
|
|
9170
|
+
instructions: z20.string().nullable().optional().describe("Complete channel-specific instructions, applied after the preset; replaces the existing text. `null` clears them. Omit to keep them.")
|
|
9153
9171
|
});
|
|
9154
9172
|
var mothershipDeleteChannelPresetToolInputSchema = mothershipSlackConfirmationSchema.extend({
|
|
9155
|
-
preset_id:
|
|
9173
|
+
preset_id: z20.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
|
|
9156
9174
|
});
|
|
9157
9175
|
|
|
9158
9176
|
// ../shared/src/routes/plugin-catalog.ts
|
|
@@ -9501,50 +9519,69 @@ var workspaceMarkedUnreadClientStateKey = orgUserClientStateKey(WORKSPACE_MARKED
|
|
|
9501
9519
|
var promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX);
|
|
9502
9520
|
|
|
9503
9521
|
// ../shared/src/routes/workspace-events.ts
|
|
9504
|
-
import { z as
|
|
9505
|
-
var workspaceChangedEventSchema =
|
|
9506
|
-
|
|
9507
|
-
type:
|
|
9508
|
-
workspaceId:
|
|
9509
|
-
workspace:
|
|
9510
|
-
completion:
|
|
9511
|
-
workspaceName:
|
|
9512
|
-
completedAt:
|
|
9513
|
-
processing:
|
|
9522
|
+
import { z as z21 } from "zod";
|
|
9523
|
+
var workspaceChangedEventSchema = z21.discriminatedUnion("type", [
|
|
9524
|
+
z21.object({
|
|
9525
|
+
type: z21.literal("workspace.changed"),
|
|
9526
|
+
workspaceId: z21.string(),
|
|
9527
|
+
workspace: z21.object({ status: z21.enum(WORKSPACE_STATUSES), last_activity_at: z21.string().nullable() }).optional(),
|
|
9528
|
+
completion: z21.object({
|
|
9529
|
+
workspaceName: z21.string(),
|
|
9530
|
+
completedAt: z21.string(),
|
|
9531
|
+
processing: z21.boolean().optional()
|
|
9514
9532
|
}).optional(),
|
|
9515
|
-
ts:
|
|
9533
|
+
ts: z21.string()
|
|
9516
9534
|
}),
|
|
9517
|
-
|
|
9518
|
-
type:
|
|
9519
|
-
workspaceId:
|
|
9520
|
-
chatId:
|
|
9521
|
-
ts:
|
|
9535
|
+
z21.object({
|
|
9536
|
+
type: z21.literal("workspace.chat.changed"),
|
|
9537
|
+
workspaceId: z21.string(),
|
|
9538
|
+
chatId: z21.string(),
|
|
9539
|
+
ts: z21.string()
|
|
9522
9540
|
}),
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
type:
|
|
9526
|
-
workspaceId:
|
|
9527
|
-
ts:
|
|
9541
|
+
z21.object({ type: z21.literal("presence.changed"), ts: z21.string() }),
|
|
9542
|
+
z21.object({
|
|
9543
|
+
type: z21.literal("mobile-testing.changed"),
|
|
9544
|
+
workspaceId: z21.string(),
|
|
9545
|
+
ts: z21.string()
|
|
9528
9546
|
})
|
|
9529
9547
|
]);
|
|
9530
9548
|
|
|
9531
9549
|
// ../shared/src/routes/presence.ts
|
|
9532
|
-
import { z as
|
|
9533
|
-
var presenceStatusSchema =
|
|
9534
|
-
var presenceLocationSchema =
|
|
9535
|
-
workspaceId:
|
|
9550
|
+
import { z as z22 } from "zod";
|
|
9551
|
+
var presenceStatusSchema = z22.enum(["online", "typing"]);
|
|
9552
|
+
var presenceLocationSchema = z22.object({
|
|
9553
|
+
workspaceId: z22.string().optional()
|
|
9536
9554
|
});
|
|
9537
|
-
var presenceEntrySchema =
|
|
9538
|
-
userId:
|
|
9555
|
+
var presenceEntrySchema = z22.object({
|
|
9556
|
+
userId: z22.string(),
|
|
9539
9557
|
status: presenceStatusSchema,
|
|
9540
9558
|
location: presenceLocationSchema,
|
|
9541
|
-
ts:
|
|
9559
|
+
ts: z22.string()
|
|
9542
9560
|
});
|
|
9543
|
-
var updatePresenceRequestSchema =
|
|
9561
|
+
var updatePresenceRequestSchema = z22.object({
|
|
9544
9562
|
status: presenceStatusSchema,
|
|
9545
9563
|
location: presenceLocationSchema.optional()
|
|
9546
9564
|
});
|
|
9547
9565
|
|
|
9566
|
+
// ../shared/src/routes/review-messages.ts
|
|
9567
|
+
import { z as z23 } from "zod";
|
|
9568
|
+
var sendPullRequestReviewMessageRequestSchema = z23.object({
|
|
9569
|
+
...sendChatMessageRequestSchema.pick({
|
|
9570
|
+
message: true,
|
|
9571
|
+
messageId: true,
|
|
9572
|
+
submittedAt: true,
|
|
9573
|
+
model: true,
|
|
9574
|
+
images: true,
|
|
9575
|
+
canvasUploadIds: true,
|
|
9576
|
+
thinkingLevel: true,
|
|
9577
|
+
fastMode: true,
|
|
9578
|
+
ultrafastMode: true
|
|
9579
|
+
}).shape,
|
|
9580
|
+
/** Starts a new chat instead of continuing the PR's review chat. The provider only applies to a new chat. */
|
|
9581
|
+
newChat: z23.boolean().optional(),
|
|
9582
|
+
provider: z23.enum(VALID_AGENT_PROVIDERS).optional()
|
|
9583
|
+
});
|
|
9584
|
+
|
|
9548
9585
|
// ../shared/src/audit-log.ts
|
|
9549
9586
|
var AUDIT_LOG_ACTION = {
|
|
9550
9587
|
CREATE: "create",
|
|
@@ -9912,6 +9949,10 @@ export {
|
|
|
9912
9949
|
OPENCODE_GO_BASE_URL,
|
|
9913
9950
|
DEFAULT_OPENCODE_GO_MODEL,
|
|
9914
9951
|
fetchOpenCodeGoCatalog,
|
|
9952
|
+
isGitHubUrl,
|
|
9953
|
+
parseCodeHostPrUrl,
|
|
9954
|
+
decodePathSegments,
|
|
9955
|
+
buildCodeHostPrUrl,
|
|
9915
9956
|
detectLanguageByPath,
|
|
9916
9957
|
isDefaultChat,
|
|
9917
9958
|
CLAUDE_OPUS_4_8_BEDROCK_MODEL,
|
|
@@ -9999,10 +10040,6 @@ export {
|
|
|
9999
10040
|
SUBAGENT_MCP_TOOLS,
|
|
10000
10041
|
SUBAGENT_MCP_TOOL_NAMES,
|
|
10001
10042
|
parseMcpToolName,
|
|
10002
|
-
isGitHubUrl,
|
|
10003
|
-
parseCodeHostPrUrl,
|
|
10004
|
-
decodePathSegments,
|
|
10005
|
-
buildCodeHostPrUrl,
|
|
10006
10043
|
createUuidFromHex,
|
|
10007
10044
|
WORKSPACE_IDENTITY_AUDIENCE,
|
|
10008
10045
|
AWS_SOURCE_IDENTITY_CLAIM,
|