@get-bb/plugin-sdk 0.6.68 → 0.6.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bundled-types/bb-plugin-sdk-app.d.ts +1138 -348
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +31 -4
- package/bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts +6 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +40 -11
- package/bundled-types/bb-plugin-sdk-testing.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk.d.ts +6425 -5651
- package/dist/app.js +103 -4
- package/dist/index.js +21 -0
- package/dist/internal/composer-handle.js +1 -1
- package/dist/internal/plugin-app-collector.js +188 -63
- package/dist/internal/rpc-query-host.js +1169 -27
- package/dist/testing/app.js +1717 -185
- package/dist/testing/index.js +14 -0
- package/package.json +1 -1
package/dist/testing/app.js
CHANGED
|
@@ -1263,6 +1263,9 @@ import { QueryClient } from "@tanstack/react-query";
|
|
|
1263
1263
|
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
1264
1264
|
import { useIsFetching } from "@tanstack/react-query";
|
|
1265
1265
|
|
|
1266
|
+
// ../domain/src/shared-types.ts
|
|
1267
|
+
import { z as z2 } from "zod";
|
|
1268
|
+
|
|
1266
1269
|
// ../domain/src/json-value.ts
|
|
1267
1270
|
import { z } from "zod";
|
|
1268
1271
|
var jsonValueSchema = z.lazy(
|
|
@@ -1280,23 +1283,1149 @@ var jsonObjectSchema = z.record(
|
|
|
1280
1283
|
jsonValueSchema
|
|
1281
1284
|
);
|
|
1282
1285
|
|
|
1286
|
+
// ../domain/src/shared-types.ts
|
|
1287
|
+
var reasoningLevelSchema = z2.string().min(1);
|
|
1288
|
+
var serviceTierSchema = z2.string().min(1);
|
|
1289
|
+
var instructionModeValues = ["append", "replace"];
|
|
1290
|
+
var instructionModeSchema = z2.enum(instructionModeValues);
|
|
1291
|
+
var permissionModeValues = ["accept-edits", "auto", "full"];
|
|
1292
|
+
var permissionModeSchema = z2.enum(permissionModeValues);
|
|
1293
|
+
var permissionModeInputSchema = z2.union([permissionModeSchema, z2.literal("workspace-write")]).transform(
|
|
1294
|
+
(permissionMode) => permissionMode === "workspace-write" ? "accept-edits" : permissionMode
|
|
1295
|
+
);
|
|
1296
|
+
var legacyRecordedPermissionModeValues = [
|
|
1297
|
+
"workspace-write",
|
|
1298
|
+
"readonly"
|
|
1299
|
+
];
|
|
1300
|
+
var recordedPermissionModeSchema = z2.enum([
|
|
1301
|
+
...permissionModeValues,
|
|
1302
|
+
...legacyRecordedPermissionModeValues
|
|
1303
|
+
]);
|
|
1304
|
+
var permissionEscalationValues = ["ask", "deny"];
|
|
1305
|
+
var permissionEscalationSchema = z2.enum(permissionEscalationValues);
|
|
1306
|
+
var promptInputVisibilityValues = ["agent-only"];
|
|
1307
|
+
var promptInputVisibilitySchema = z2.enum(promptInputVisibilityValues);
|
|
1308
|
+
var promptInputVisibilityFields = {
|
|
1309
|
+
visibility: promptInputVisibilitySchema.optional()
|
|
1310
|
+
};
|
|
1311
|
+
var promptMentionPathSourceValues = ["workspace", "thread-storage"];
|
|
1312
|
+
var promptMentionPathSourceSchema = z2.enum(promptMentionPathSourceValues);
|
|
1313
|
+
var promptMentionPathEntryKindValues = ["file", "directory"];
|
|
1314
|
+
var promptMentionPathEntryKindSchema = z2.enum(
|
|
1315
|
+
promptMentionPathEntryKindValues
|
|
1316
|
+
);
|
|
1317
|
+
var promptMentionCommandTriggerValues = ["/", "$"];
|
|
1318
|
+
var promptMentionCommandTriggerSchema = z2.enum(
|
|
1319
|
+
promptMentionCommandTriggerValues
|
|
1320
|
+
);
|
|
1321
|
+
var promptMentionCommandSourceValues = ["skill", "command"];
|
|
1322
|
+
var promptMentionCommandSourceSchema = z2.enum(
|
|
1323
|
+
promptMentionCommandSourceValues
|
|
1324
|
+
);
|
|
1325
|
+
var promptMentionCommandOriginValues = [
|
|
1326
|
+
"builtin",
|
|
1327
|
+
"project",
|
|
1328
|
+
"user"
|
|
1329
|
+
];
|
|
1330
|
+
var promptMentionCommandOriginSchema = z2.enum(
|
|
1331
|
+
promptMentionCommandOriginValues
|
|
1332
|
+
);
|
|
1333
|
+
var canonicalPromptMentionResourceSchema = z2.discriminatedUnion("kind", [
|
|
1334
|
+
z2.object({
|
|
1335
|
+
kind: z2.literal("thread"),
|
|
1336
|
+
threadId: z2.string(),
|
|
1337
|
+
projectId: z2.string().optional(),
|
|
1338
|
+
label: z2.string()
|
|
1339
|
+
}),
|
|
1340
|
+
z2.object({
|
|
1341
|
+
kind: z2.literal("project"),
|
|
1342
|
+
projectId: z2.string(),
|
|
1343
|
+
label: z2.string()
|
|
1344
|
+
}),
|
|
1345
|
+
z2.object({
|
|
1346
|
+
kind: z2.literal("section"),
|
|
1347
|
+
sectionId: z2.string(),
|
|
1348
|
+
label: z2.string()
|
|
1349
|
+
}),
|
|
1350
|
+
z2.object({
|
|
1351
|
+
kind: z2.literal("path"),
|
|
1352
|
+
source: promptMentionPathSourceSchema,
|
|
1353
|
+
entryKind: promptMentionPathEntryKindSchema,
|
|
1354
|
+
path: z2.string(),
|
|
1355
|
+
label: z2.string()
|
|
1356
|
+
}),
|
|
1357
|
+
z2.object({
|
|
1358
|
+
kind: z2.literal("command"),
|
|
1359
|
+
trigger: promptMentionCommandTriggerSchema,
|
|
1360
|
+
name: z2.string(),
|
|
1361
|
+
source: promptMentionCommandSourceSchema,
|
|
1362
|
+
origin: promptMentionCommandOriginSchema,
|
|
1363
|
+
label: z2.string(),
|
|
1364
|
+
argumentHint: z2.string().nullable()
|
|
1365
|
+
}),
|
|
1366
|
+
z2.object({
|
|
1367
|
+
kind: z2.literal("plugin"),
|
|
1368
|
+
pluginId: z2.string(),
|
|
1369
|
+
icon: z2.string().nullable().optional(),
|
|
1370
|
+
itemId: z2.string(),
|
|
1371
|
+
label: z2.string()
|
|
1372
|
+
}),
|
|
1373
|
+
z2.object({
|
|
1374
|
+
kind: z2.literal("attachment"),
|
|
1375
|
+
path: z2.string(),
|
|
1376
|
+
label: z2.string()
|
|
1377
|
+
})
|
|
1378
|
+
]);
|
|
1379
|
+
function normalizeLegacyPromptMentionResource(value) {
|
|
1380
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
1381
|
+
return value;
|
|
1382
|
+
}
|
|
1383
|
+
const record = value;
|
|
1384
|
+
if (record.kind !== "folder" || typeof record.folderId !== "string") {
|
|
1385
|
+
return value;
|
|
1386
|
+
}
|
|
1387
|
+
const { folderId, ...rest } = record;
|
|
1388
|
+
return { ...rest, kind: "section", sectionId: folderId };
|
|
1389
|
+
}
|
|
1390
|
+
var promptMentionResourceSchema = z2.preprocess(
|
|
1391
|
+
normalizeLegacyPromptMentionResource,
|
|
1392
|
+
canonicalPromptMentionResourceSchema
|
|
1393
|
+
);
|
|
1394
|
+
var promptTextMentionSchema = z2.object({
|
|
1395
|
+
start: z2.number().int().nonnegative(),
|
|
1396
|
+
end: z2.number().int().nonnegative(),
|
|
1397
|
+
resource: promptMentionResourceSchema
|
|
1398
|
+
});
|
|
1399
|
+
var promptInputSchema = z2.discriminatedUnion("type", [
|
|
1400
|
+
z2.object({
|
|
1401
|
+
type: z2.literal("text"),
|
|
1402
|
+
text: z2.string(),
|
|
1403
|
+
mentions: z2.array(promptTextMentionSchema).default([]),
|
|
1404
|
+
...promptInputVisibilityFields
|
|
1405
|
+
}),
|
|
1406
|
+
z2.object({
|
|
1407
|
+
type: z2.literal("image"),
|
|
1408
|
+
url: z2.string().url(),
|
|
1409
|
+
...promptInputVisibilityFields
|
|
1410
|
+
}),
|
|
1411
|
+
z2.object({
|
|
1412
|
+
type: z2.literal("localImage"),
|
|
1413
|
+
path: z2.string(),
|
|
1414
|
+
sourceProjectId: z2.string().min(1).optional(),
|
|
1415
|
+
hostId: z2.string().min(1).optional(),
|
|
1416
|
+
...promptInputVisibilityFields
|
|
1417
|
+
}),
|
|
1418
|
+
z2.object({
|
|
1419
|
+
type: z2.literal("localFile"),
|
|
1420
|
+
path: z2.string(),
|
|
1421
|
+
sourceProjectId: z2.string().min(1).optional(),
|
|
1422
|
+
hostId: z2.string().min(1).optional(),
|
|
1423
|
+
name: z2.string().optional(),
|
|
1424
|
+
sizeBytes: z2.number().int().nonnegative().optional(),
|
|
1425
|
+
mimeType: z2.string().optional(),
|
|
1426
|
+
...promptInputVisibilityFields
|
|
1427
|
+
})
|
|
1428
|
+
]);
|
|
1429
|
+
var threadExecutionSourceSchema = z2.enum([
|
|
1430
|
+
"client/thread/start",
|
|
1431
|
+
"client/turn/requested",
|
|
1432
|
+
"client/turn/start"
|
|
1433
|
+
]);
|
|
1434
|
+
var callerExecutionInputSourceValues = [
|
|
1435
|
+
"explicit",
|
|
1436
|
+
"client-preference"
|
|
1437
|
+
];
|
|
1438
|
+
var callerExecutionInputSourceSchema = z2.enum(
|
|
1439
|
+
callerExecutionInputSourceValues
|
|
1440
|
+
);
|
|
1441
|
+
var threadExecutionOptionsSchema = z2.object({
|
|
1442
|
+
model: z2.string().optional(),
|
|
1443
|
+
serviceTier: serviceTierSchema.optional(),
|
|
1444
|
+
reasoningLevel: reasoningLevelSchema.optional(),
|
|
1445
|
+
permissionMode: permissionModeSchema.optional(),
|
|
1446
|
+
source: threadExecutionSourceSchema.optional(),
|
|
1447
|
+
seq: z2.number().int().optional()
|
|
1448
|
+
});
|
|
1449
|
+
var resolvedThreadExecutionOptionsSchema = threadExecutionOptionsSchema.extend({
|
|
1450
|
+
model: z2.string().min(1),
|
|
1451
|
+
serviceTier: serviceTierSchema,
|
|
1452
|
+
reasoningLevel: reasoningLevelSchema,
|
|
1453
|
+
permissionMode: permissionModeSchema,
|
|
1454
|
+
source: threadExecutionSourceSchema
|
|
1455
|
+
});
|
|
1456
|
+
var recordedThreadExecutionOptionsSchema = resolvedThreadExecutionOptionsSchema.extend({
|
|
1457
|
+
permissionMode: recordedPermissionModeSchema
|
|
1458
|
+
});
|
|
1459
|
+
var runtimePermissionScopeValues = ["workspace", "full"];
|
|
1460
|
+
var runtimePermissionScopeSchema = z2.enum(runtimePermissionScopeValues);
|
|
1461
|
+
var runtimePermissionPolicySchema = z2.discriminatedUnion(
|
|
1462
|
+
"permissionMode",
|
|
1463
|
+
[
|
|
1464
|
+
z2.object({
|
|
1465
|
+
permissionMode: z2.literal("accept-edits"),
|
|
1466
|
+
permissionScope: z2.literal("workspace"),
|
|
1467
|
+
approvalReviewer: z2.literal("user"),
|
|
1468
|
+
permissionEscalation: permissionEscalationSchema
|
|
1469
|
+
}),
|
|
1470
|
+
z2.object({
|
|
1471
|
+
permissionMode: z2.literal("auto"),
|
|
1472
|
+
permissionScope: z2.literal("workspace"),
|
|
1473
|
+
approvalReviewer: z2.literal("automatic"),
|
|
1474
|
+
permissionEscalation: permissionEscalationSchema
|
|
1475
|
+
}),
|
|
1476
|
+
z2.object({
|
|
1477
|
+
permissionMode: z2.literal("full"),
|
|
1478
|
+
permissionScope: z2.literal("full"),
|
|
1479
|
+
approvalReviewer: z2.null(),
|
|
1480
|
+
permissionEscalation: z2.null()
|
|
1481
|
+
})
|
|
1482
|
+
]
|
|
1483
|
+
);
|
|
1484
|
+
var promptModeSchema = z2.literal("plan");
|
|
1485
|
+
var sessionOptionValueSchema = z2.union([z2.string(), z2.boolean()]);
|
|
1486
|
+
var sessionOptionSelectionsSchema = z2.record(
|
|
1487
|
+
z2.string().min(1),
|
|
1488
|
+
sessionOptionValueSchema
|
|
1489
|
+
);
|
|
1490
|
+
var runtimeThreadExecutionBaseOptionsSchema = z2.object({
|
|
1491
|
+
model: z2.string().min(1),
|
|
1492
|
+
serviceTier: serviceTierSchema,
|
|
1493
|
+
reasoningLevel: reasoningLevelSchema,
|
|
1494
|
+
promptMode: promptModeSchema.optional(),
|
|
1495
|
+
sessionOptions: sessionOptionSelectionsSchema.optional(),
|
|
1496
|
+
providerOptions: jsonObjectSchema
|
|
1497
|
+
});
|
|
1498
|
+
var runtimeThreadExecutionOptionsSchema = runtimeThreadExecutionBaseOptionsSchema.and(runtimePermissionPolicySchema);
|
|
1499
|
+
var projectExecutionDefaultsSchema = z2.object({
|
|
1500
|
+
providerId: z2.string().min(1),
|
|
1501
|
+
model: z2.string().min(1),
|
|
1502
|
+
serviceTier: serviceTierSchema,
|
|
1503
|
+
reasoningLevel: reasoningLevelSchema,
|
|
1504
|
+
permissionMode: permissionModeSchema
|
|
1505
|
+
});
|
|
1506
|
+
|
|
1507
|
+
// ../domain/src/git-checkout.ts
|
|
1508
|
+
import { z as z3 } from "zod";
|
|
1509
|
+
var gitBranchForbiddenCharacterPattern = /[\u0000-\u001f\u007f\\:~^?*\[]/u;
|
|
1510
|
+
var gitBranchWhitespacePattern = /[ \t]/u;
|
|
1511
|
+
var gitReservedBranchNames = /* @__PURE__ */ new Set([
|
|
1512
|
+
"AUTO_MERGE",
|
|
1513
|
+
"BISECT_HEAD",
|
|
1514
|
+
"CHERRY_PICK_HEAD",
|
|
1515
|
+
"FETCH_HEAD",
|
|
1516
|
+
"HEAD",
|
|
1517
|
+
"MERGE_HEAD",
|
|
1518
|
+
"ORIG_HEAD",
|
|
1519
|
+
"REVERT_HEAD"
|
|
1520
|
+
]);
|
|
1521
|
+
function isValidGitBranchName(name) {
|
|
1522
|
+
const components = name.split("/");
|
|
1523
|
+
return name.length > 0 && name.trim().length > 0 && !name.startsWith("-") && !name.startsWith("/") && name !== "@" && !gitReservedBranchNames.has(name) && !gitBranchForbiddenCharacterPattern.test(name) && !gitBranchWhitespacePattern.test(name) && !name.includes("..") && !name.includes("@{") && !name.includes("//") && !name.endsWith("/") && !name.endsWith(".") && components.every(
|
|
1524
|
+
(component) => component.length > 0 && !component.startsWith(".") && !component.endsWith(".lock")
|
|
1525
|
+
);
|
|
1526
|
+
}
|
|
1527
|
+
var gitBranchNameSchema = z3.string().refine(isValidGitBranchName, { message: "Invalid git branch name" });
|
|
1528
|
+
var gitBranchSelectionSchema = z3.discriminatedUnion("kind", [
|
|
1529
|
+
z3.object({ kind: z3.literal("named"), name: gitBranchNameSchema }),
|
|
1530
|
+
z3.object({ kind: z3.literal("default") })
|
|
1531
|
+
]);
|
|
1532
|
+
var gitCheckoutRefSchema = z3.discriminatedUnion("kind", [
|
|
1533
|
+
z3.object({
|
|
1534
|
+
kind: z3.literal("branch"),
|
|
1535
|
+
branchName: z3.string().min(1),
|
|
1536
|
+
headSha: z3.string().min(1).nullable()
|
|
1537
|
+
}),
|
|
1538
|
+
z3.object({
|
|
1539
|
+
kind: z3.literal("detached"),
|
|
1540
|
+
headSha: z3.string().min(1).nullable()
|
|
1541
|
+
}),
|
|
1542
|
+
z3.object({
|
|
1543
|
+
kind: z3.literal("unborn"),
|
|
1544
|
+
branchName: z3.string().min(1).nullable()
|
|
1545
|
+
}),
|
|
1546
|
+
z3.object({
|
|
1547
|
+
kind: z3.literal("unknown"),
|
|
1548
|
+
reason: z3.string().min(1)
|
|
1549
|
+
})
|
|
1550
|
+
]);
|
|
1551
|
+
var workspaceGitOperationSchema = z3.discriminatedUnion("kind", [
|
|
1552
|
+
z3.object({ kind: z3.literal("none") }),
|
|
1553
|
+
z3.object({
|
|
1554
|
+
kind: z3.literal("merge"),
|
|
1555
|
+
hasConflicts: z3.boolean()
|
|
1556
|
+
}),
|
|
1557
|
+
z3.object({
|
|
1558
|
+
kind: z3.literal("rebase"),
|
|
1559
|
+
hasConflicts: z3.boolean()
|
|
1560
|
+
}),
|
|
1561
|
+
z3.object({
|
|
1562
|
+
kind: z3.literal("cherry-pick"),
|
|
1563
|
+
hasConflicts: z3.boolean()
|
|
1564
|
+
}),
|
|
1565
|
+
z3.object({
|
|
1566
|
+
kind: z3.literal("revert"),
|
|
1567
|
+
hasConflicts: z3.boolean()
|
|
1568
|
+
}),
|
|
1569
|
+
z3.object({
|
|
1570
|
+
kind: z3.literal("unknown"),
|
|
1571
|
+
reason: z3.string().min(1),
|
|
1572
|
+
hasConflicts: z3.boolean()
|
|
1573
|
+
})
|
|
1574
|
+
]);
|
|
1575
|
+
var gitBranchRefClassificationSchema = z3.object({
|
|
1576
|
+
name: z3.string().min(1),
|
|
1577
|
+
kind: z3.enum(["local", "remote", "missing"])
|
|
1578
|
+
});
|
|
1579
|
+
var defaultBranchRelationSchema = z3.enum([
|
|
1580
|
+
"equal",
|
|
1581
|
+
"local-behind",
|
|
1582
|
+
"local-ahead",
|
|
1583
|
+
"diverged",
|
|
1584
|
+
"unknown"
|
|
1585
|
+
]);
|
|
1586
|
+
var gitSourceInspectionSchema = z3.object({
|
|
1587
|
+
checkout: gitCheckoutRefSchema,
|
|
1588
|
+
defaultBranch: z3.string().min(1).nullable(),
|
|
1589
|
+
isWorktree: z3.boolean(),
|
|
1590
|
+
defaultBranchRelation: defaultBranchRelationSchema.nullable(),
|
|
1591
|
+
hasUncommittedChanges: z3.boolean(),
|
|
1592
|
+
operation: workspaceGitOperationSchema,
|
|
1593
|
+
originDefaultBranch: z3.string().min(1).nullable()
|
|
1594
|
+
});
|
|
1595
|
+
var gitBranchOptionsSchema = z3.object({
|
|
1596
|
+
branches: z3.array(z3.string()),
|
|
1597
|
+
branchesTruncated: z3.boolean(),
|
|
1598
|
+
remoteBranches: z3.array(z3.string()),
|
|
1599
|
+
remoteBranchesTruncated: z3.boolean(),
|
|
1600
|
+
selectedBranch: gitBranchRefClassificationSchema.nullable()
|
|
1601
|
+
});
|
|
1602
|
+
var projectSourceCheckoutSchema = gitSourceInspectionSchema.extend(
|
|
1603
|
+
gitBranchOptionsSchema.shape
|
|
1604
|
+
);
|
|
1605
|
+
|
|
1606
|
+
// ../domain/src/change-kinds.ts
|
|
1607
|
+
import { z as z18 } from "zod";
|
|
1608
|
+
|
|
1609
|
+
// ../domain/src/thread-event-types.ts
|
|
1610
|
+
import { z as z4 } from "zod";
|
|
1611
|
+
var systemEventTypeValues = [
|
|
1612
|
+
"client/thread/start",
|
|
1613
|
+
"client/turn/requested",
|
|
1614
|
+
"client/turn/rejected",
|
|
1615
|
+
"client/turn/start",
|
|
1616
|
+
"system/error",
|
|
1617
|
+
"system/manager/user_message",
|
|
1618
|
+
"system/thread/interrupted",
|
|
1619
|
+
"system/operation",
|
|
1620
|
+
"system/interaction/lifecycle",
|
|
1621
|
+
"system/permissionGrant/lifecycle",
|
|
1622
|
+
"system/userQuestion/lifecycle",
|
|
1623
|
+
"system/thread-provisioning",
|
|
1624
|
+
"system/provider-turn-watchdog"
|
|
1625
|
+
];
|
|
1626
|
+
var providerEventTypeValues = [
|
|
1627
|
+
"thread/started",
|
|
1628
|
+
"thread/identity",
|
|
1629
|
+
"turn/started",
|
|
1630
|
+
"turn/completed",
|
|
1631
|
+
"turn/input/accepted",
|
|
1632
|
+
"thread/name/updated",
|
|
1633
|
+
"thread/compacted",
|
|
1634
|
+
"thread/context/cleared",
|
|
1635
|
+
"thread/goal/updated",
|
|
1636
|
+
"thread/goal/cleared",
|
|
1637
|
+
"item/started",
|
|
1638
|
+
"item/completed",
|
|
1639
|
+
"item/agentMessage/delta",
|
|
1640
|
+
"item/commandExecution/outputDelta",
|
|
1641
|
+
"item/fileChange/outputDelta",
|
|
1642
|
+
"item/reasoning/summaryTextDelta",
|
|
1643
|
+
"item/reasoning/textDelta",
|
|
1644
|
+
"item/plan/delta",
|
|
1645
|
+
"item/mcpToolCall/progress",
|
|
1646
|
+
"item/toolCall/progress",
|
|
1647
|
+
"item/backgroundTask/progress",
|
|
1648
|
+
"item/backgroundTask/completed",
|
|
1649
|
+
"item/delegation/progress",
|
|
1650
|
+
"item/delegation/completed",
|
|
1651
|
+
"thread/tokenUsage/updated",
|
|
1652
|
+
"thread/contextWindowUsage/updated",
|
|
1653
|
+
"turn/plan/updated",
|
|
1654
|
+
"turn/mainRun/updated",
|
|
1655
|
+
"turn/diff/updated",
|
|
1656
|
+
"provider/error",
|
|
1657
|
+
"provider/rateLimits/updated",
|
|
1658
|
+
"provider.env-resolved",
|
|
1659
|
+
"thread/extensionState/updated",
|
|
1660
|
+
"provider/warning",
|
|
1661
|
+
"provider/modelFallback",
|
|
1662
|
+
"provider/unhandled"
|
|
1663
|
+
];
|
|
1664
|
+
var threadEventTypeValues = [
|
|
1665
|
+
...providerEventTypeValues,
|
|
1666
|
+
...systemEventTypeValues
|
|
1667
|
+
];
|
|
1668
|
+
var threadEventTypeSet = new Set(threadEventTypeValues);
|
|
1669
|
+
var threadEventTypeSchema = z4.string().refine(
|
|
1670
|
+
(value) => threadEventTypeSet.has(value),
|
|
1671
|
+
"Invalid thread event type"
|
|
1672
|
+
);
|
|
1673
|
+
|
|
1674
|
+
// ../domain/src/thread.ts
|
|
1675
|
+
import { z as z17 } from "zod";
|
|
1676
|
+
|
|
1677
|
+
// ../domain/src/thread-create-origin.ts
|
|
1678
|
+
import { z as z5 } from "zod";
|
|
1679
|
+
var threadCreateOriginValues = ["app", "cli", "sdk", "plugin"];
|
|
1680
|
+
var threadCreateOriginSchema = z5.enum(threadCreateOriginValues);
|
|
1681
|
+
|
|
1682
|
+
// ../domain/src/environment.ts
|
|
1683
|
+
import { z as z6 } from "zod";
|
|
1684
|
+
var environmentMachineSelectionSchema = z6.discriminatedUnion("type", [
|
|
1685
|
+
z6.object({ type: z6.literal("existing"), hostId: z6.string().min(1) }),
|
|
1686
|
+
z6.object({
|
|
1687
|
+
type: z6.literal("new"),
|
|
1688
|
+
machineProviderId: z6.string().min(1),
|
|
1689
|
+
inputs: jsonValueSchema.nullable()
|
|
1690
|
+
})
|
|
1691
|
+
]);
|
|
1692
|
+
var environmentProviderSelectionSchema = z6.object({
|
|
1693
|
+
machine: environmentMachineSelectionSchema,
|
|
1694
|
+
inputs: jsonValueSchema.nullable()
|
|
1695
|
+
});
|
|
1696
|
+
var environmentStatusValues = [
|
|
1697
|
+
"creating",
|
|
1698
|
+
"provisioning",
|
|
1699
|
+
"ready",
|
|
1700
|
+
"error",
|
|
1701
|
+
"destroyed"
|
|
1702
|
+
];
|
|
1703
|
+
var environmentStatusSchema = z6.enum(environmentStatusValues);
|
|
1704
|
+
var environmentHostLifecycleValues = [
|
|
1705
|
+
"active",
|
|
1706
|
+
"removing",
|
|
1707
|
+
"cleanup-failed",
|
|
1708
|
+
"removed"
|
|
1709
|
+
];
|
|
1710
|
+
var environmentHostLifecycleSchema = z6.enum(
|
|
1711
|
+
environmentHostLifecycleValues
|
|
1712
|
+
);
|
|
1713
|
+
var WORKSPACE_PROVISION_TYPES = [
|
|
1714
|
+
"unmanaged",
|
|
1715
|
+
"managed-worktree",
|
|
1716
|
+
"personal"
|
|
1717
|
+
];
|
|
1718
|
+
var workspaceProvisionTypeSchema = z6.enum(WORKSPACE_PROVISION_TYPES);
|
|
1719
|
+
var environmentWorkspaceDisplayKindValues = [
|
|
1720
|
+
"managed-worktree",
|
|
1721
|
+
"unmanaged-worktree",
|
|
1722
|
+
"other"
|
|
1723
|
+
];
|
|
1724
|
+
var environmentWorkspaceDisplayKindSchema = z6.enum(
|
|
1725
|
+
environmentWorkspaceDisplayKindValues
|
|
1726
|
+
);
|
|
1727
|
+
var discoveredWorkspacePropertiesSchema = z6.object({
|
|
1728
|
+
path: z6.string().min(1),
|
|
1729
|
+
isGitRepo: z6.boolean(),
|
|
1730
|
+
isWorktree: z6.boolean(),
|
|
1731
|
+
branchName: z6.string().nullable(),
|
|
1732
|
+
defaultBranch: z6.string().nullable()
|
|
1733
|
+
});
|
|
1734
|
+
var environmentLifecycleSchema = z6.object({
|
|
1735
|
+
phase: z6.enum(["active", "retiring", "teardown", "destroyed"]),
|
|
1736
|
+
retireAt: z6.number().nullable(),
|
|
1737
|
+
teardown: z6.object({
|
|
1738
|
+
status: z6.enum(["running", "failed", "removed"]),
|
|
1739
|
+
attempt: z6.number().int().nonnegative(),
|
|
1740
|
+
message: z6.string().optional()
|
|
1741
|
+
}).nullable()
|
|
1742
|
+
});
|
|
1743
|
+
var environmentSchema = z6.object({
|
|
1744
|
+
id: z6.string(),
|
|
1745
|
+
name: z6.string().nullable(),
|
|
1746
|
+
projectId: z6.string(),
|
|
1747
|
+
hostId: z6.string(),
|
|
1748
|
+
path: z6.string().nullable(),
|
|
1749
|
+
isGitRepo: z6.boolean(),
|
|
1750
|
+
isWorktree: z6.boolean(),
|
|
1751
|
+
branchName: z6.string().nullable(),
|
|
1752
|
+
baseBranch: z6.string().nullable(),
|
|
1753
|
+
defaultBranch: z6.string().nullable(),
|
|
1754
|
+
mergeBaseBranch: z6.string().nullable(),
|
|
1755
|
+
status: environmentStatusSchema,
|
|
1756
|
+
environmentProviderId: z6.string().nullable(),
|
|
1757
|
+
lifecycle: environmentLifecycleSchema,
|
|
1758
|
+
hostLifecycle: environmentHostLifecycleSchema,
|
|
1759
|
+
environmentProviderSelection: environmentProviderSelectionSchema.nullable(),
|
|
1760
|
+
environmentProviderInstanceKey: z6.string().nullable(),
|
|
1761
|
+
managed: z6.boolean(),
|
|
1762
|
+
workspaceProvisionType: workspaceProvisionTypeSchema.nullable(),
|
|
1763
|
+
createdAt: z6.number(),
|
|
1764
|
+
updatedAt: z6.number()
|
|
1765
|
+
});
|
|
1766
|
+
|
|
1767
|
+
// ../domain/src/queued-message.ts
|
|
1768
|
+
import { z as z10 } from "zod";
|
|
1769
|
+
|
|
1770
|
+
// ../domain/src/plugin-id.ts
|
|
1771
|
+
import { z as z7 } from "zod";
|
|
1772
|
+
var pluginIdSchema = z7.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
|
|
1773
|
+
|
|
1774
|
+
// ../domain/src/protocol-ids.ts
|
|
1775
|
+
import { z as z8 } from "zod";
|
|
1776
|
+
var clientTurnRequestIdSchema = z8.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
|
|
1777
|
+
|
|
1778
|
+
// ../domain/src/system-message.ts
|
|
1779
|
+
import { z as z9 } from "zod";
|
|
1780
|
+
var systemMessageKindValues = [
|
|
1781
|
+
"ownership-assigned",
|
|
1782
|
+
"ownership-removed",
|
|
1783
|
+
"child-needs-attention",
|
|
1784
|
+
"child-completed",
|
|
1785
|
+
"child-failed",
|
|
1786
|
+
"child-interrupted",
|
|
1787
|
+
"child-outcome-batch",
|
|
1788
|
+
"tool-result-delivered",
|
|
1789
|
+
"environment-directory-updated",
|
|
1790
|
+
"unlabeled"
|
|
1791
|
+
];
|
|
1792
|
+
var systemMessageKindSchema = z9.enum(systemMessageKindValues);
|
|
1793
|
+
var systemThreadInterruptedReasonSchema = z9.enum([
|
|
1794
|
+
"manual-stop",
|
|
1795
|
+
"host-daemon-restarted",
|
|
1796
|
+
"host-removed",
|
|
1797
|
+
"provider-turn-idle"
|
|
1798
|
+
]);
|
|
1799
|
+
var childThreadOutcomeSchema = z9.object({
|
|
1800
|
+
threadId: z9.string(),
|
|
1801
|
+
status: z9.enum(["completed", "failed", "interrupted"]),
|
|
1802
|
+
interruption: z9.object({
|
|
1803
|
+
reason: systemThreadInterruptedReasonSchema,
|
|
1804
|
+
cause: z9.literal("host-connection-lost").optional()
|
|
1805
|
+
}).optional()
|
|
1806
|
+
});
|
|
1807
|
+
var systemMessageSubjectSchema = z9.discriminatedUnion("kind", [
|
|
1808
|
+
z9.object({
|
|
1809
|
+
kind: z9.literal("thread"),
|
|
1810
|
+
threadId: z9.string(),
|
|
1811
|
+
threadName: z9.string(),
|
|
1812
|
+
outcomes: z9.array(childThreadOutcomeSchema).optional()
|
|
1813
|
+
}),
|
|
1814
|
+
z9.object({
|
|
1815
|
+
kind: z9.literal("thread-batch"),
|
|
1816
|
+
count: z9.number(),
|
|
1817
|
+
outcomes: z9.array(childThreadOutcomeSchema).optional()
|
|
1818
|
+
}),
|
|
1819
|
+
z9.object({
|
|
1820
|
+
kind: z9.literal("tool-call"),
|
|
1821
|
+
toolName: z9.string(),
|
|
1822
|
+
suppress: z9.boolean()
|
|
1823
|
+
}),
|
|
1824
|
+
z9.object({
|
|
1825
|
+
kind: z9.literal("directory"),
|
|
1826
|
+
path: z9.string()
|
|
1827
|
+
})
|
|
1828
|
+
]);
|
|
1829
|
+
|
|
1830
|
+
// ../domain/src/queued-message.ts
|
|
1831
|
+
var queuedMessageWaitingOnKindValues = [
|
|
1832
|
+
"time",
|
|
1833
|
+
"thread-busy",
|
|
1834
|
+
"stopping",
|
|
1835
|
+
"turn-starting",
|
|
1836
|
+
"provisioning",
|
|
1837
|
+
"host-offline",
|
|
1838
|
+
"interaction",
|
|
1839
|
+
"plugin"
|
|
1840
|
+
];
|
|
1841
|
+
var queuedMessageWaitingOnKindSchema = z10.enum(
|
|
1842
|
+
queuedMessageWaitingOnKindValues
|
|
1843
|
+
);
|
|
1844
|
+
var queuedMessageWaitHostNameSchema = z10.string().min(1).max(200);
|
|
1845
|
+
var QUEUED_MESSAGE_WAIT_REASON_MAX_LENGTH = 200;
|
|
1846
|
+
var queuedMessageWaitReasonSchema = z10.string().min(1).max(QUEUED_MESSAGE_WAIT_REASON_MAX_LENGTH);
|
|
1847
|
+
var queuedMessageWaitingOnSchema = z10.discriminatedUnion("kind", [
|
|
1848
|
+
z10.object({ kind: z10.literal("time") }),
|
|
1849
|
+
z10.object({ kind: z10.literal("thread-busy") }),
|
|
1850
|
+
z10.object({ kind: z10.literal("stopping") }),
|
|
1851
|
+
z10.object({ kind: z10.literal("turn-starting") }),
|
|
1852
|
+
z10.object({ kind: z10.literal("provisioning") }),
|
|
1853
|
+
z10.object({
|
|
1854
|
+
kind: z10.literal("host-offline"),
|
|
1855
|
+
hostName: queuedMessageWaitHostNameSchema
|
|
1856
|
+
}),
|
|
1857
|
+
z10.object({ kind: z10.literal("interaction") }),
|
|
1858
|
+
z10.object({
|
|
1859
|
+
kind: z10.literal("plugin"),
|
|
1860
|
+
pluginId: pluginIdSchema,
|
|
1861
|
+
reason: queuedMessageWaitReasonSchema
|
|
1862
|
+
})
|
|
1863
|
+
]);
|
|
1864
|
+
var QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH = 200;
|
|
1865
|
+
var queuedMessageFailureReasonSchema = z10.string().min(1).max(QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH);
|
|
1866
|
+
var QUEUED_MESSAGE_PLUGIN_WAIT_HOLDER_PREFIX = "plugin:";
|
|
1867
|
+
var queuedMessageWaitHolderSchema = z10.templateLiteral([
|
|
1868
|
+
QUEUED_MESSAGE_PLUGIN_WAIT_HOLDER_PREFIX,
|
|
1869
|
+
pluginIdSchema
|
|
1870
|
+
]);
|
|
1871
|
+
var queuedMessagePayloadKindValues = ["inline", "retry"];
|
|
1872
|
+
var queuedMessagePayloadKindSchema = z10.enum(
|
|
1873
|
+
queuedMessagePayloadKindValues
|
|
1874
|
+
);
|
|
1875
|
+
var queuedMessagePayloadSchema = z10.discriminatedUnion("kind", [
|
|
1876
|
+
z10.object({ kind: z10.literal("inline") }),
|
|
1877
|
+
z10.object({
|
|
1878
|
+
kind: z10.literal("retry"),
|
|
1879
|
+
/**
|
|
1880
|
+
* The ORIGINAL request, not the attempt that just failed. Retrying a retry
|
|
1881
|
+
* re-submits the same original blocks, so this id is carried forward
|
|
1882
|
+
* unchanged across attempts and `attempt` is what distinguishes them.
|
|
1883
|
+
*/
|
|
1884
|
+
retryOfTurnRequestId: clientTurnRequestIdSchema,
|
|
1885
|
+
/** Which attempt this row will dispatch: 2 is the first retry. */
|
|
1886
|
+
attempt: z10.number().int().min(2),
|
|
1887
|
+
/**
|
|
1888
|
+
* Why this turn is being retried, in the retrier's words ("Rate limited"),
|
|
1889
|
+
* as the row's card and `bb thread queue list` render it.
|
|
1890
|
+
*
|
|
1891
|
+
* It lives on the payload rather than on `waitingOn` because a retry can
|
|
1892
|
+
* wait on the clock, on a limiter, or on nothing at all, and the reason
|
|
1893
|
+
* outlives all three: it is a fact about the retry, not about what is
|
|
1894
|
+
* currently holding it. Filled at the boundary, so every row has one.
|
|
1895
|
+
*/
|
|
1896
|
+
reason: queuedMessageWaitReasonSchema
|
|
1897
|
+
})
|
|
1898
|
+
]);
|
|
1899
|
+
var queuedMessageSystemNoticeSchema = z10.object({
|
|
1900
|
+
kind: systemMessageKindSchema,
|
|
1901
|
+
subject: systemMessageSubjectSchema.nullable()
|
|
1902
|
+
});
|
|
1903
|
+
|
|
1904
|
+
// ../domain/src/queued-message-lifecycle.ts
|
|
1905
|
+
import { z as z11 } from "zod";
|
|
1906
|
+
var queuedMessageStateValues = [
|
|
1907
|
+
"queued",
|
|
1908
|
+
"scheduled",
|
|
1909
|
+
"waiting",
|
|
1910
|
+
"failed_retrying",
|
|
1911
|
+
"failed_exhausted",
|
|
1912
|
+
"claimed"
|
|
1913
|
+
];
|
|
1914
|
+
var queuedMessageStateSchema = z11.enum(queuedMessageStateValues);
|
|
1915
|
+
|
|
1916
|
+
// ../domain/src/thread-status.ts
|
|
1917
|
+
import { z as z12 } from "zod";
|
|
1918
|
+
var threadStatusValues = [
|
|
1919
|
+
"pending",
|
|
1920
|
+
"idle",
|
|
1921
|
+
"starting",
|
|
1922
|
+
"active",
|
|
1923
|
+
"stopping",
|
|
1924
|
+
"error"
|
|
1925
|
+
];
|
|
1926
|
+
var threadStatusSchema = z12.enum(threadStatusValues);
|
|
1927
|
+
|
|
1928
|
+
// ../domain/src/thread-origin-kind.ts
|
|
1929
|
+
import { z as z13 } from "zod";
|
|
1930
|
+
var threadOriginKindValues = ["fork"];
|
|
1931
|
+
var threadOriginKindSchema = z13.enum(threadOriginKindValues);
|
|
1932
|
+
|
|
1933
|
+
// ../domain/src/thread-parent-notifications.ts
|
|
1934
|
+
import { z as z14 } from "zod";
|
|
1935
|
+
var threadParentNotificationsValues = [
|
|
1936
|
+
"auto",
|
|
1937
|
+
"stuck",
|
|
1938
|
+
"off"
|
|
1939
|
+
];
|
|
1940
|
+
var threadParentNotificationsSchema = z14.enum(
|
|
1941
|
+
threadParentNotificationsValues
|
|
1942
|
+
);
|
|
1943
|
+
|
|
1944
|
+
// ../domain/src/thread-visibility.ts
|
|
1945
|
+
import { z as z15 } from "zod";
|
|
1946
|
+
var threadVisibilityValues = ["visible", "hidden"];
|
|
1947
|
+
var threadVisibilitySchema = z15.enum(threadVisibilityValues);
|
|
1948
|
+
|
|
1949
|
+
// ../domain/src/thread-runtime-state.ts
|
|
1950
|
+
import { z as z16 } from "zod";
|
|
1951
|
+
var threadRuntimeDisplayStatusValues = [
|
|
1952
|
+
...threadStatusValues,
|
|
1953
|
+
"provisioning",
|
|
1954
|
+
"waiting-for-host"
|
|
1955
|
+
];
|
|
1956
|
+
var threadRuntimeDisplayStatusSchema = z16.enum(
|
|
1957
|
+
threadRuntimeDisplayStatusValues
|
|
1958
|
+
);
|
|
1959
|
+
var threadRuntimeStateSchema = z16.object({
|
|
1960
|
+
displayStatus: threadRuntimeDisplayStatusSchema
|
|
1961
|
+
});
|
|
1962
|
+
var threadActivityStateSchema = z16.object({
|
|
1963
|
+
activeWorkflowCount: z16.number().int().nonnegative(),
|
|
1964
|
+
activeBackgroundAgentCount: z16.number().int().nonnegative(),
|
|
1965
|
+
activeBackgroundCommandCount: z16.number().int().nonnegative(),
|
|
1966
|
+
activePlanModeCount: z16.number().int().nonnegative(),
|
|
1967
|
+
activeGoalCount: z16.number().int().nonnegative()
|
|
1968
|
+
});
|
|
1969
|
+
|
|
1970
|
+
// ../domain/src/thread.ts
|
|
1971
|
+
var workspaceStateValues = [
|
|
1972
|
+
"clean",
|
|
1973
|
+
"untracked",
|
|
1974
|
+
"dirty_uncommitted",
|
|
1975
|
+
"committed_unmerged",
|
|
1976
|
+
"dirty_and_committed_unmerged"
|
|
1977
|
+
];
|
|
1978
|
+
var workspaceStateSchema = z17.enum(workspaceStateValues);
|
|
1979
|
+
var workspaceFileStatusKindSchema = z17.enum([
|
|
1980
|
+
"M",
|
|
1981
|
+
"A",
|
|
1982
|
+
"D",
|
|
1983
|
+
"R",
|
|
1984
|
+
"C",
|
|
1985
|
+
"U",
|
|
1986
|
+
"??",
|
|
1987
|
+
"?"
|
|
1988
|
+
]);
|
|
1989
|
+
var workspaceFileStatusSchema = z17.object({
|
|
1990
|
+
path: z17.string(),
|
|
1991
|
+
status: workspaceFileStatusKindSchema,
|
|
1992
|
+
insertions: z17.number().nullable(),
|
|
1993
|
+
deletions: z17.number().nullable()
|
|
1994
|
+
});
|
|
1995
|
+
var workspaceCommitSummarySchema = z17.object({
|
|
1996
|
+
sha: z17.string(),
|
|
1997
|
+
shortSha: z17.string(),
|
|
1998
|
+
subject: z17.string(),
|
|
1999
|
+
authorName: z17.string(),
|
|
2000
|
+
authoredAt: z17.number()
|
|
2001
|
+
});
|
|
2002
|
+
var workspaceChangeStatsSchema = z17.object({
|
|
2003
|
+
insertions: z17.number(),
|
|
2004
|
+
deletions: z17.number(),
|
|
2005
|
+
lineStatsComplete: z17.boolean(),
|
|
2006
|
+
fileCount: z17.number().int().nonnegative(),
|
|
2007
|
+
files: z17.array(workspaceFileStatusSchema)
|
|
2008
|
+
});
|
|
2009
|
+
var workspaceWorkingTreeSchema = workspaceChangeStatsSchema.extend({
|
|
2010
|
+
hasUncommittedChanges: z17.boolean(),
|
|
2011
|
+
state: workspaceStateSchema
|
|
2012
|
+
});
|
|
2013
|
+
var workspaceBranchSchema = z17.object({
|
|
2014
|
+
currentBranch: z17.string().nullable(),
|
|
2015
|
+
defaultBranch: z17.string()
|
|
2016
|
+
});
|
|
2017
|
+
var workspaceMergeBaseSchema = workspaceChangeStatsSchema.extend({
|
|
2018
|
+
mergeBaseBranch: z17.string(),
|
|
2019
|
+
baseRef: z17.string().nullable(),
|
|
2020
|
+
aheadCount: z17.number(),
|
|
2021
|
+
behindCount: z17.number(),
|
|
2022
|
+
squashMergeCheckComplete: z17.boolean(),
|
|
2023
|
+
hasCommittedUnmergedChanges: z17.boolean(),
|
|
2024
|
+
commits: z17.array(workspaceCommitSummarySchema)
|
|
2025
|
+
});
|
|
2026
|
+
var workspaceStatusSchema = z17.object({
|
|
2027
|
+
workingTree: workspaceWorkingTreeSchema,
|
|
2028
|
+
checkout: gitCheckoutRefSchema,
|
|
2029
|
+
branch: workspaceBranchSchema,
|
|
2030
|
+
mergeBase: workspaceMergeBaseSchema.nullable()
|
|
2031
|
+
});
|
|
2032
|
+
var threadQueuedMessageSchema = z17.object({
|
|
2033
|
+
id: z17.string(),
|
|
2034
|
+
origin: threadCreateOriginSchema.nullable(),
|
|
2035
|
+
originPluginId: z17.string().nullable(),
|
|
2036
|
+
initiator: z17.enum(["user", "agent", "system"]),
|
|
2037
|
+
senderThreadId: z17.string().nullable(),
|
|
2038
|
+
/**
|
|
2039
|
+
* The thread this row is waiting on. Redundant on the thread-scoped list
|
|
2040
|
+
* route that first served this DTO, and load-bearing everywhere else it is
|
|
2041
|
+
* now served: a `queue.*` plugin event and a cross-thread wait-holder query
|
|
2042
|
+
* both hand out rows with no surrounding thread to read it from.
|
|
2043
|
+
*/
|
|
2044
|
+
threadId: z17.string(),
|
|
2045
|
+
content: z17.array(promptInputSchema).min(1),
|
|
2046
|
+
model: z17.string().min(1),
|
|
2047
|
+
reasoningLevel: reasoningLevelSchema,
|
|
2048
|
+
permissionMode: permissionModeSchema,
|
|
2049
|
+
serviceTier: serviceTierSchema,
|
|
2050
|
+
groupWithNext: z17.boolean(),
|
|
2051
|
+
/**
|
|
2052
|
+
* Epoch ms this row is scheduled to attempt dispatch, or null when it is
|
|
2053
|
+
* eligible as soon as its other waits clear.
|
|
2054
|
+
*/
|
|
2055
|
+
sendAt: z17.number().int().nonnegative().nullable(),
|
|
2056
|
+
state: queuedMessageStateSchema,
|
|
2057
|
+
/**
|
|
2058
|
+
* Why this row is queued, or null for a `queued` row that is simply next in
|
|
2059
|
+
* line behind the running turn.
|
|
2060
|
+
*/
|
|
2061
|
+
waitingOn: queuedMessageWaitingOnSchema.nullable(),
|
|
2062
|
+
/**
|
|
2063
|
+
* Why this row's last DRAIN attempt failed outright, or null when it has not
|
|
2064
|
+
* failed one — which is every row that has never been re-attempted, and
|
|
2065
|
+
* every row whose latest attempt merely queued again. An inline attempt
|
|
2066
|
+
* reports its failure to the sender that is still listening and never lands
|
|
2067
|
+
* here.
|
|
2068
|
+
*
|
|
2069
|
+
* Independent of `waitingOn`, not folded into it: the row is still waiting on
|
|
2070
|
+
* whatever it was waiting on, and writing a wait rewrites it wholesale, so a
|
|
2071
|
+
* failure stored there would not survive the next attempt.
|
|
2072
|
+
*/
|
|
2073
|
+
failureReason: queuedMessageFailureReasonSchema.nullable(),
|
|
2074
|
+
payload: queuedMessagePayloadSchema,
|
|
2075
|
+
/**
|
|
2076
|
+
* Whether the sender may still rewrite this row's input. Not derivable from
|
|
2077
|
+
* `payload` alone: a `retry` row is never editable, and an `inline` row
|
|
2078
|
+
* stops being editable once the drain has claimed it — and the claim is
|
|
2079
|
+
* deliberately not part of this response, since it is drain bookkeeping and
|
|
2080
|
+
* not something a client should reason about. The server folds both into
|
|
2081
|
+
* this one answer.
|
|
2082
|
+
*/
|
|
2083
|
+
editable: z17.boolean(),
|
|
2084
|
+
createdAt: z17.number(),
|
|
2085
|
+
updatedAt: z17.number()
|
|
2086
|
+
});
|
|
2087
|
+
var threadSchema = z17.object({
|
|
2088
|
+
id: z17.string(),
|
|
2089
|
+
projectId: z17.string(),
|
|
2090
|
+
environmentId: z17.string().nullable(),
|
|
2091
|
+
providerId: z17.string(),
|
|
2092
|
+
title: z17.string().nullable(),
|
|
2093
|
+
titleFallback: z17.string().nullable(),
|
|
2094
|
+
sectionId: z17.string().nullable(),
|
|
2095
|
+
status: threadStatusSchema,
|
|
2096
|
+
parentThreadId: z17.string().nullable(),
|
|
2097
|
+
lifecycleOwnerThreadId: z17.string().nullable(),
|
|
2098
|
+
sourceThreadId: z17.string().nullable(),
|
|
2099
|
+
originKind: threadOriginKindSchema.nullable(),
|
|
2100
|
+
originPluginId: z17.string().nullable(),
|
|
2101
|
+
visibility: threadVisibilitySchema,
|
|
2102
|
+
parentNotifications: threadParentNotificationsSchema,
|
|
2103
|
+
archivedAt: z17.number().nullable(),
|
|
2104
|
+
pinnedAt: z17.number().nullable(),
|
|
2105
|
+
deletedAt: z17.number().nullable(),
|
|
2106
|
+
lastReadAt: z17.number().nullable(),
|
|
2107
|
+
latestAttentionAt: z17.number(),
|
|
2108
|
+
createdAt: z17.number(),
|
|
2109
|
+
updatedAt: z17.number()
|
|
2110
|
+
});
|
|
2111
|
+
var threadWithRuntimeSchema = threadSchema.extend({
|
|
2112
|
+
runtime: threadRuntimeStateSchema
|
|
2113
|
+
});
|
|
2114
|
+
var threadQueuedWorkValues = ["none", "waiting", "failed"];
|
|
2115
|
+
var threadQueuedWorkSchema = z17.enum(threadQueuedWorkValues);
|
|
2116
|
+
var threadListEntrySchema = threadWithRuntimeSchema.extend({
|
|
2117
|
+
activity: threadActivityStateSchema,
|
|
2118
|
+
queuedWork: threadQueuedWorkSchema,
|
|
2119
|
+
pinSortKey: z17.string().nullable(),
|
|
2120
|
+
hasPendingInteraction: z17.boolean(),
|
|
2121
|
+
environmentHostId: z17.string().nullable(),
|
|
2122
|
+
environmentName: z17.string().nullable(),
|
|
2123
|
+
environmentBranchName: z17.string().nullable(),
|
|
2124
|
+
environmentPath: z17.string().nullable(),
|
|
2125
|
+
environmentProviderId: z17.string().nullable(),
|
|
2126
|
+
environmentIsWorktree: z17.boolean().nullable(),
|
|
2127
|
+
environmentWorkspaceDisplayKind: environmentWorkspaceDisplayKindSchema
|
|
2128
|
+
});
|
|
2129
|
+
|
|
2130
|
+
// ../domain/src/change-kinds.ts
|
|
2131
|
+
var THREAD_CHANGE_KINDS = [
|
|
2132
|
+
"thread-created",
|
|
2133
|
+
"thread-deleted",
|
|
2134
|
+
"events-appended",
|
|
2135
|
+
"history-rewritten",
|
|
2136
|
+
"history-compacted",
|
|
2137
|
+
"interactions-changed",
|
|
2138
|
+
"status-changed",
|
|
2139
|
+
"title-changed",
|
|
2140
|
+
"queue-changed",
|
|
2141
|
+
"archived-changed",
|
|
2142
|
+
"pin-state-changed",
|
|
2143
|
+
"parent-changed",
|
|
2144
|
+
"environment-changed",
|
|
2145
|
+
"read-state-changed",
|
|
2146
|
+
"tabs-changed",
|
|
2147
|
+
"terminals-changed"
|
|
2148
|
+
];
|
|
2149
|
+
var PROJECT_CHANGE_KINDS = [
|
|
2150
|
+
"project-created",
|
|
2151
|
+
"project-updated",
|
|
2152
|
+
"project-deleted",
|
|
2153
|
+
"project-sources-changed",
|
|
2154
|
+
"threads-changed",
|
|
2155
|
+
"project-order-changed"
|
|
2156
|
+
];
|
|
2157
|
+
var ENVIRONMENT_CHANGE_KINDS = [
|
|
2158
|
+
"environment-created",
|
|
2159
|
+
"environment-deleted",
|
|
2160
|
+
"metadata-changed",
|
|
2161
|
+
"status-changed",
|
|
2162
|
+
"work-status-changed",
|
|
2163
|
+
"git-refs-changed",
|
|
2164
|
+
"thread-storage-changed",
|
|
2165
|
+
"diff-viewed-changed"
|
|
2166
|
+
];
|
|
2167
|
+
var HOST_CHANGE_KINDS = [
|
|
2168
|
+
"host-connected",
|
|
2169
|
+
"host-disconnected",
|
|
2170
|
+
"provider-model-catalog-changed"
|
|
2171
|
+
];
|
|
2172
|
+
var SYSTEM_CHANGE_KINDS = [
|
|
2173
|
+
"config-changed",
|
|
2174
|
+
"plugins-changed",
|
|
2175
|
+
"plugin-install-jobs-changed",
|
|
2176
|
+
"plugin-update-jobs-changed",
|
|
2177
|
+
"provider-registrations-changed",
|
|
2178
|
+
"environment-availability-changed",
|
|
2179
|
+
"server-move-changed",
|
|
2180
|
+
"app-update-changed"
|
|
2181
|
+
];
|
|
2182
|
+
var threadChangeKindSchema = z18.enum(THREAD_CHANGE_KINDS);
|
|
2183
|
+
var projectChangeKindSchema = z18.enum(PROJECT_CHANGE_KINDS);
|
|
2184
|
+
var environmentChangeKindSchema = z18.enum(ENVIRONMENT_CHANGE_KINDS);
|
|
2185
|
+
var hostChangeKindSchema = z18.enum(HOST_CHANGE_KINDS);
|
|
2186
|
+
var systemChangeKindSchema = z18.enum(SYSTEM_CHANGE_KINDS);
|
|
2187
|
+
var threadTimelineSubscriptionTargetSchema = z18.object({
|
|
2188
|
+
kind: z18.literal("thread-timeline"),
|
|
2189
|
+
threadId: z18.string().min(1),
|
|
2190
|
+
segmentLimit: z18.number().int().positive().nullable(),
|
|
2191
|
+
deferContent: z18.boolean()
|
|
2192
|
+
}).strict();
|
|
2193
|
+
function canonicalPluginReadInput(value) {
|
|
2194
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
2195
|
+
if (Array.isArray(value))
|
|
2196
|
+
return `[${value.map(canonicalPluginReadInput).join(",")}]`;
|
|
2197
|
+
return `{${Object.keys(value).sort().map(
|
|
2198
|
+
(key) => `${JSON.stringify(key)}:${canonicalPluginReadInput(value[key])}`
|
|
2199
|
+
).join(",")}}`;
|
|
2200
|
+
}
|
|
2201
|
+
var pluginReadSubscriptionTargetSchema = z18.object({
|
|
2202
|
+
kind: z18.literal("plugin-read"),
|
|
2203
|
+
pluginId: z18.string().min(1),
|
|
2204
|
+
method: z18.string().min(1),
|
|
2205
|
+
read: z18.union([
|
|
2206
|
+
z18.object({ input: jsonValueSchema }).strict(),
|
|
2207
|
+
z18.object({ key: z18.string() }).strict()
|
|
2208
|
+
]).refine(
|
|
2209
|
+
(read) => new TextEncoder().encode(canonicalPluginReadInput(read)).byteLength <= 16384,
|
|
2210
|
+
"Plugin read input exceeds 16 KiB"
|
|
2211
|
+
)
|
|
2212
|
+
}).strict();
|
|
2213
|
+
var realtimeSubscriptionTargetSchema = z18.discriminatedUnion("kind", [
|
|
2214
|
+
pluginReadSubscriptionTargetSchema,
|
|
2215
|
+
z18.object({ kind: z18.literal("plugin"), pluginId: z18.string().min(1) }).strict(),
|
|
2216
|
+
z18.object({
|
|
2217
|
+
kind: z18.literal("thread-detail"),
|
|
2218
|
+
threadId: z18.string().min(1)
|
|
2219
|
+
}).strict(),
|
|
2220
|
+
threadTimelineSubscriptionTargetSchema,
|
|
2221
|
+
z18.object({
|
|
2222
|
+
kind: z18.literal("thread-list")
|
|
2223
|
+
}).strict(),
|
|
2224
|
+
z18.object({
|
|
2225
|
+
kind: z18.literal("project-detail"),
|
|
2226
|
+
projectId: z18.string().min(1)
|
|
2227
|
+
}).strict(),
|
|
2228
|
+
z18.object({
|
|
2229
|
+
kind: z18.literal("project-list")
|
|
2230
|
+
}).strict(),
|
|
2231
|
+
z18.object({
|
|
2232
|
+
kind: z18.literal("environment-detail"),
|
|
2233
|
+
environmentId: z18.string().min(1)
|
|
2234
|
+
}).strict(),
|
|
2235
|
+
z18.object({
|
|
2236
|
+
kind: z18.literal("environment-list")
|
|
2237
|
+
}).strict(),
|
|
2238
|
+
z18.object({
|
|
2239
|
+
kind: z18.literal("host-detail"),
|
|
2240
|
+
hostId: z18.string().min(1)
|
|
2241
|
+
}).strict(),
|
|
2242
|
+
z18.object({
|
|
2243
|
+
kind: z18.literal("host-list")
|
|
2244
|
+
}).strict(),
|
|
2245
|
+
z18.object({
|
|
2246
|
+
kind: z18.literal("system")
|
|
2247
|
+
}).strict()
|
|
2248
|
+
]);
|
|
2249
|
+
function isValidSubscriptionTarget(value) {
|
|
2250
|
+
return realtimeSubscriptionTargetSchema.safeParse(value).success;
|
|
2251
|
+
}
|
|
2252
|
+
var validSubscriptionTargetsSchema = z18.preprocess(
|
|
2253
|
+
(value) => Array.isArray(value) ? value.filter(isValidSubscriptionTarget) : value,
|
|
2254
|
+
z18.array(realtimeSubscriptionTargetSchema)
|
|
2255
|
+
);
|
|
2256
|
+
var validSubscriptionTargetSchema = z18.preprocess(
|
|
2257
|
+
(value) => value === void 0 || isValidSubscriptionTarget(value) ? value : null,
|
|
2258
|
+
realtimeSubscriptionTargetSchema.nullable().optional()
|
|
2259
|
+
);
|
|
2260
|
+
var subscriptionFields = {
|
|
2261
|
+
target: validSubscriptionTargetSchema,
|
|
2262
|
+
targets: validSubscriptionTargetsSchema.optional()
|
|
2263
|
+
};
|
|
2264
|
+
var hasSubscriptionTargets = (value) => value.target !== void 0 !== (value.targets !== void 0);
|
|
2265
|
+
var subscribeMessageSchema = z18.object({ type: z18.literal("subscribe"), ...subscriptionFields }).refine(hasSubscriptionTargets);
|
|
2266
|
+
var unsubscribeMessageSchema = z18.object({ type: z18.literal("unsubscribe"), ...subscriptionFields }).refine(hasSubscriptionTargets);
|
|
2267
|
+
var pingMessageSchema = z18.object({
|
|
2268
|
+
type: z18.literal("ping")
|
|
2269
|
+
});
|
|
2270
|
+
var visibilityMessageSchema = z18.object({
|
|
2271
|
+
type: z18.literal("visibility"),
|
|
2272
|
+
visible: z18.boolean()
|
|
2273
|
+
});
|
|
2274
|
+
var clientMessageSchema = z18.discriminatedUnion("type", [
|
|
2275
|
+
subscribeMessageSchema,
|
|
2276
|
+
unsubscribeMessageSchema,
|
|
2277
|
+
pingMessageSchema,
|
|
2278
|
+
visibilityMessageSchema
|
|
2279
|
+
]);
|
|
2280
|
+
var pongMessageSchema = z18.object({
|
|
2281
|
+
type: z18.literal("pong")
|
|
2282
|
+
}).strict();
|
|
2283
|
+
var pongMessageLenientSchema = z18.object({
|
|
2284
|
+
type: z18.literal("pong")
|
|
2285
|
+
});
|
|
2286
|
+
var threadStatusChangeMetadataSchema = z18.object({
|
|
2287
|
+
status: threadStatusSchema,
|
|
2288
|
+
runtime: threadRuntimeStateSchema,
|
|
2289
|
+
activity: threadActivityStateSchema,
|
|
2290
|
+
latestAttentionAt: z18.number(),
|
|
2291
|
+
updatedAt: z18.number()
|
|
2292
|
+
}).strict();
|
|
2293
|
+
var threadChangeMetadataSchema = z18.object({
|
|
2294
|
+
backgroundActivityChanged: z18.boolean().optional(),
|
|
2295
|
+
eventTypes: z18.array(threadEventTypeSchema).readonly().optional(),
|
|
2296
|
+
timelineSequence: z18.number().int().nonnegative().optional(),
|
|
2297
|
+
hasPendingInteraction: z18.boolean().optional(),
|
|
2298
|
+
projectId: z18.string().optional(),
|
|
2299
|
+
statusChange: threadStatusChangeMetadataSchema.optional()
|
|
2300
|
+
}).strict();
|
|
2301
|
+
var threadChangedMessageSchema = z18.object({
|
|
2302
|
+
type: z18.literal("changed"),
|
|
2303
|
+
entity: z18.literal("thread"),
|
|
2304
|
+
id: z18.string().optional(),
|
|
2305
|
+
metadata: threadChangeMetadataSchema.optional(),
|
|
2306
|
+
changes: z18.array(threadChangeKindSchema).readonly()
|
|
2307
|
+
}).strict();
|
|
2308
|
+
var projectChangedMessageSchema = z18.object({
|
|
2309
|
+
type: z18.literal("changed"),
|
|
2310
|
+
entity: z18.literal("project"),
|
|
2311
|
+
id: z18.string().optional(),
|
|
2312
|
+
changes: z18.array(projectChangeKindSchema).readonly()
|
|
2313
|
+
}).strict();
|
|
2314
|
+
var environmentChangedMessageSchema = z18.object({
|
|
2315
|
+
type: z18.literal("changed"),
|
|
2316
|
+
entity: z18.literal("environment"),
|
|
2317
|
+
id: z18.string().optional(),
|
|
2318
|
+
changes: z18.array(environmentChangeKindSchema).readonly()
|
|
2319
|
+
}).strict();
|
|
2320
|
+
var hostChangedMessageSchema = z18.object({
|
|
2321
|
+
type: z18.literal("changed"),
|
|
2322
|
+
entity: z18.literal("host"),
|
|
2323
|
+
id: z18.string().optional(),
|
|
2324
|
+
changes: z18.array(hostChangeKindSchema).readonly()
|
|
2325
|
+
}).strict();
|
|
2326
|
+
var systemChangedMessageSchema = z18.object({
|
|
2327
|
+
type: z18.literal("changed"),
|
|
2328
|
+
entity: z18.literal("system"),
|
|
2329
|
+
changes: z18.array(systemChangeKindSchema).readonly()
|
|
2330
|
+
}).strict();
|
|
2331
|
+
var tagsChangedMessageSchema = z18.object({
|
|
2332
|
+
type: z18.literal("changed"),
|
|
2333
|
+
entity: z18.literal("tags"),
|
|
2334
|
+
tags: z18.array(z18.string().min(1)).min(1)
|
|
2335
|
+
}).strict();
|
|
2336
|
+
var pluginChangedMessageSchema = z18.object({
|
|
2337
|
+
type: z18.literal("changed"),
|
|
2338
|
+
entity: z18.literal("plugin"),
|
|
2339
|
+
pluginId: z18.string().min(1),
|
|
2340
|
+
tags: z18.array(z18.string().min(1)).min(1).nullable()
|
|
2341
|
+
}).strict();
|
|
2342
|
+
var changedMessageSchema = z18.discriminatedUnion("entity", [
|
|
2343
|
+
threadChangedMessageSchema,
|
|
2344
|
+
projectChangedMessageSchema,
|
|
2345
|
+
environmentChangedMessageSchema,
|
|
2346
|
+
hostChangedMessageSchema,
|
|
2347
|
+
systemChangedMessageSchema,
|
|
2348
|
+
tagsChangedMessageSchema,
|
|
2349
|
+
pluginChangedMessageSchema
|
|
2350
|
+
]);
|
|
2351
|
+
function lenientKinds(kinds) {
|
|
2352
|
+
const known = new Set(kinds);
|
|
2353
|
+
return z18.array(z18.string()).transform(
|
|
2354
|
+
(values) => values.filter((value) => known.has(value))
|
|
2355
|
+
);
|
|
2356
|
+
}
|
|
2357
|
+
var knownThreadEventTypes = new Set(
|
|
2358
|
+
threadEventTypeValues
|
|
2359
|
+
);
|
|
2360
|
+
var threadChangeMetadataLenientSchema = z18.object({
|
|
2361
|
+
timelineSequence: z18.number().int().nonnegative().optional(),
|
|
2362
|
+
backgroundActivityChanged: z18.boolean().optional(),
|
|
2363
|
+
eventTypes: z18.array(z18.string()).transform(
|
|
2364
|
+
(values) => values.filter(
|
|
2365
|
+
(value) => knownThreadEventTypes.has(value)
|
|
2366
|
+
)
|
|
2367
|
+
).optional(),
|
|
2368
|
+
hasPendingInteraction: z18.boolean().optional(),
|
|
2369
|
+
projectId: z18.string().optional(),
|
|
2370
|
+
statusChange: threadStatusChangeMetadataSchema.optional().catch(void 0)
|
|
2371
|
+
});
|
|
2372
|
+
var threadChangedMessageLenientSchema = z18.object({
|
|
2373
|
+
type: z18.literal("changed"),
|
|
2374
|
+
entity: z18.literal("thread"),
|
|
2375
|
+
id: z18.string().optional(),
|
|
2376
|
+
metadata: threadChangeMetadataLenientSchema.optional(),
|
|
2377
|
+
changes: lenientKinds(THREAD_CHANGE_KINDS)
|
|
2378
|
+
});
|
|
2379
|
+
var projectChangedMessageLenientSchema = z18.object({
|
|
2380
|
+
type: z18.literal("changed"),
|
|
2381
|
+
entity: z18.literal("project"),
|
|
2382
|
+
id: z18.string().optional(),
|
|
2383
|
+
changes: lenientKinds(PROJECT_CHANGE_KINDS)
|
|
2384
|
+
});
|
|
2385
|
+
var environmentChangedMessageLenientSchema = z18.object({
|
|
2386
|
+
type: z18.literal("changed"),
|
|
2387
|
+
entity: z18.literal("environment"),
|
|
2388
|
+
id: z18.string().optional(),
|
|
2389
|
+
changes: lenientKinds(ENVIRONMENT_CHANGE_KINDS)
|
|
2390
|
+
});
|
|
2391
|
+
var hostChangedMessageLenientSchema = z18.object({
|
|
2392
|
+
type: z18.literal("changed"),
|
|
2393
|
+
entity: z18.literal("host"),
|
|
2394
|
+
id: z18.string().optional(),
|
|
2395
|
+
changes: lenientKinds(HOST_CHANGE_KINDS)
|
|
2396
|
+
});
|
|
2397
|
+
var systemChangedMessageLenientSchema = z18.object({
|
|
2398
|
+
type: z18.literal("changed"),
|
|
2399
|
+
entity: z18.literal("system"),
|
|
2400
|
+
changes: lenientKinds(SYSTEM_CHANGE_KINDS)
|
|
2401
|
+
});
|
|
2402
|
+
var changedMessageLenientSchema = z18.discriminatedUnion("entity", [
|
|
2403
|
+
threadChangedMessageLenientSchema,
|
|
2404
|
+
projectChangedMessageLenientSchema,
|
|
2405
|
+
environmentChangedMessageLenientSchema,
|
|
2406
|
+
hostChangedMessageLenientSchema,
|
|
2407
|
+
systemChangedMessageLenientSchema,
|
|
2408
|
+
tagsChangedMessageSchema.strip(),
|
|
2409
|
+
pluginChangedMessageSchema.strip()
|
|
2410
|
+
]);
|
|
2411
|
+
|
|
1283
2412
|
// src/internal/rpc-tags.ts
|
|
1284
|
-
import { z as
|
|
1285
|
-
var rpcInvalidationTags =
|
|
2413
|
+
import { z as z19 } from "zod";
|
|
2414
|
+
var rpcInvalidationTags = z19.array(z19.string().min(1)).min(1);
|
|
1286
2415
|
function rpcResponseTags(declarations, input, output) {
|
|
1287
|
-
const tags =
|
|
2416
|
+
const tags = z19.array(z19.string().min(1)).parse(declarations.tags?.(input, output) ?? []);
|
|
1288
2417
|
const keyTags = {};
|
|
1289
2418
|
if (declarations.keyTags && typeof output === "object" && output !== null && !Array.isArray(output)) {
|
|
1290
2419
|
for (const [key, value] of Object.entries(output)) {
|
|
1291
|
-
keyTags[key] =
|
|
2420
|
+
keyTags[key] = z19.array(z19.string().min(1)).parse(declarations.keyTags(key, value));
|
|
1292
2421
|
}
|
|
1293
2422
|
}
|
|
1294
|
-
const invalidated =
|
|
2423
|
+
const invalidated = z19.array(z19.string().min(1)).parse(declarations.invalidates?.(input, output) ?? []);
|
|
1295
2424
|
return { tags, keyTags, invalidated };
|
|
1296
2425
|
}
|
|
1297
2426
|
|
|
1298
2427
|
// src/internal/rpc-query-host.ts
|
|
1299
|
-
import { z as
|
|
2428
|
+
import { z as z20 } from "zod";
|
|
1300
2429
|
var rpcQueryKey = (pluginId, method, input) => [
|
|
1301
2430
|
"plugin-rpc",
|
|
1302
2431
|
pluginId,
|
|
@@ -1369,6 +2498,15 @@ async function callRpc(host, pluginId, contract, method, input) {
|
|
|
1369
2498
|
...rpcResponseTags(methodContract, parsedInput.value, result.data)
|
|
1370
2499
|
};
|
|
1371
2500
|
}
|
|
2501
|
+
function resolvePluginId(host, pluginId) {
|
|
2502
|
+
const resolved = pluginId ?? host.pluginId;
|
|
2503
|
+
if (resolved === null) {
|
|
2504
|
+
throw new Error(
|
|
2505
|
+
"plugin RPC hooks outside a plugin slot component need an explicit pluginId"
|
|
2506
|
+
);
|
|
2507
|
+
}
|
|
2508
|
+
return resolved;
|
|
2509
|
+
}
|
|
1372
2510
|
var tagsOf = (data) => [
|
|
1373
2511
|
...data.tags,
|
|
1374
2512
|
...Object.values(data.keyTags).flat()
|
|
@@ -1383,10 +2521,17 @@ function createRpcQueryHooks(useHost) {
|
|
|
1383
2521
|
}
|
|
1384
2522
|
const experimental_useRpcQuery = (options) => {
|
|
1385
2523
|
const host = useHost();
|
|
1386
|
-
const pluginId = options.pluginId
|
|
2524
|
+
const pluginId = resolvePluginId(host, options.pluginId);
|
|
1387
2525
|
const input = jsonValueSchema.parse(options.input ?? null);
|
|
1388
2526
|
const queryKey = rpcQueryKey(pluginId, options.method, input);
|
|
1389
2527
|
useSubscription(host, pluginId, options.enabled ?? true);
|
|
2528
|
+
const watchIdentity = canonicalPluginReadInput(input);
|
|
2529
|
+
useEffect2(() => {
|
|
2530
|
+
if (options.enabled === false) return;
|
|
2531
|
+
return host.watch?.(pluginId, options.method, {
|
|
2532
|
+
input: jsonValueSchema.parse(JSON.parse(watchIdentity))
|
|
2533
|
+
});
|
|
2534
|
+
}, [host, pluginId, options.method, watchIdentity, options.enabled]);
|
|
1390
2535
|
const query = useTaggedQuery(
|
|
1391
2536
|
{
|
|
1392
2537
|
queryKey,
|
|
@@ -1398,13 +2543,7 @@ function createRpcQueryHooks(useHost) {
|
|
|
1398
2543
|
queryFn: () => runTaggedRead(
|
|
1399
2544
|
host.queryClient,
|
|
1400
2545
|
queryKey,
|
|
1401
|
-
async () => callRpc(
|
|
1402
|
-
host,
|
|
1403
|
-
pluginId,
|
|
1404
|
-
options.contract,
|
|
1405
|
-
options.method,
|
|
1406
|
-
input
|
|
1407
|
-
)
|
|
2546
|
+
async () => callRpc(host, pluginId, options.contract, options.method, input)
|
|
1408
2547
|
)
|
|
1409
2548
|
},
|
|
1410
2549
|
host.queryClient
|
|
@@ -1424,11 +2563,11 @@ function createRpcQueryHooks(useHost) {
|
|
|
1424
2563
|
};
|
|
1425
2564
|
function experimental_useRpcKeyedQuery(options) {
|
|
1426
2565
|
const host = useHost();
|
|
1427
|
-
const pluginId = options.pluginId
|
|
2566
|
+
const pluginId = resolvePluginId(host, options.pluginId);
|
|
1428
2567
|
const enabled = options.enabled ?? true;
|
|
1429
2568
|
const identity = JSON.stringify([...new Set(options.keys)].sort());
|
|
1430
2569
|
const keys = useMemo2(
|
|
1431
|
-
() =>
|
|
2570
|
+
() => z20.array(z20.string()).parse(JSON.parse(identity)),
|
|
1432
2571
|
[identity]
|
|
1433
2572
|
);
|
|
1434
2573
|
let cache = owners.get(host.queryClient);
|
|
@@ -1454,7 +2593,7 @@ function createRpcQueryHooks(useHost) {
|
|
|
1454
2593
|
);
|
|
1455
2594
|
return {
|
|
1456
2595
|
...response,
|
|
1457
|
-
result:
|
|
2596
|
+
result: z20.record(z20.string(), jsonValueSchema).parse(response.result)
|
|
1458
2597
|
};
|
|
1459
2598
|
}
|
|
1460
2599
|
});
|
|
@@ -1491,6 +2630,15 @@ function createRpcQueryHooks(useHost) {
|
|
|
1491
2630
|
[keys, enabled, selectRows]
|
|
1492
2631
|
);
|
|
1493
2632
|
const query = useQuerySelection(subscribe, getSnapshot, select);
|
|
2633
|
+
useEffect2(() => {
|
|
2634
|
+
if (!enabled) return;
|
|
2635
|
+
const releases = keys.map(
|
|
2636
|
+
(key) => host.watch?.(pluginId, options.method, { key })
|
|
2637
|
+
);
|
|
2638
|
+
return () => {
|
|
2639
|
+
releases.forEach((release) => release?.());
|
|
2640
|
+
};
|
|
2641
|
+
}, [host, pluginId, options.method, keys, enabled]);
|
|
1494
2642
|
const refetch = useCallback2(async () => {
|
|
1495
2643
|
await current.observer.refetch();
|
|
1496
2644
|
}, [current]);
|
|
@@ -1501,7 +2649,7 @@ function createRpcQueryHooks(useHost) {
|
|
|
1501
2649
|
}
|
|
1502
2650
|
function experimental_useRpcMutation(options) {
|
|
1503
2651
|
const host = useHost();
|
|
1504
|
-
const pluginId = options.pluginId
|
|
2652
|
+
const pluginId = resolvePluginId(host, options.pluginId);
|
|
1505
2653
|
const mutation = useTaggedMutation({
|
|
1506
2654
|
client: host.queryClient,
|
|
1507
2655
|
invalidate: (tags) => invalidateTags(host.queryClient, pluginTagScope(pluginId), tags),
|
|
@@ -1550,18 +2698,12 @@ function createRpcQueryHooks(useHost) {
|
|
|
1550
2698
|
}
|
|
1551
2699
|
function experimental_useRpcRefresh() {
|
|
1552
2700
|
const host = useHost();
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
host.queryClient
|
|
1556
|
-
) > 0;
|
|
2701
|
+
const pluginId = resolvePluginId(host, void 0);
|
|
2702
|
+
const isRefreshing = useIsFetching({ queryKey: ["plugin-rpc", pluginId] }, host.queryClient) > 0;
|
|
1557
2703
|
return {
|
|
1558
2704
|
isRefreshing,
|
|
1559
2705
|
refresh: () => {
|
|
1560
|
-
void invalidateTags(
|
|
1561
|
-
host.queryClient,
|
|
1562
|
-
pluginTagScope(host.pluginId),
|
|
1563
|
-
null
|
|
1564
|
-
);
|
|
2706
|
+
void invalidateTags(host.queryClient, pluginTagScope(pluginId), null);
|
|
1565
2707
|
}
|
|
1566
2708
|
};
|
|
1567
2709
|
}
|
|
@@ -1577,6 +2719,7 @@ function createRpcQueryHooks(useHost) {
|
|
|
1577
2719
|
import * as React from "react";
|
|
1578
2720
|
import {
|
|
1579
2721
|
createContext,
|
|
2722
|
+
Fragment,
|
|
1580
2723
|
useCallback as useCallback3,
|
|
1581
2724
|
useContext,
|
|
1582
2725
|
useLayoutEffect,
|
|
@@ -1650,71 +2793,71 @@ function reconcileComposerMentions(currentText, nextText, mentions) {
|
|
|
1650
2793
|
}
|
|
1651
2794
|
|
|
1652
2795
|
// src/internal/composer-draft-actions.ts
|
|
1653
|
-
import { z as
|
|
2796
|
+
import { z as z21 } from "zod";
|
|
1654
2797
|
var range = {
|
|
1655
|
-
from:
|
|
1656
|
-
to:
|
|
1657
|
-
label:
|
|
2798
|
+
from: z21.number().int().nonnegative(),
|
|
2799
|
+
to: z21.number().int().nonnegative(),
|
|
2800
|
+
label: z21.string()
|
|
1658
2801
|
};
|
|
1659
|
-
var mentionSchema =
|
|
1660
|
-
|
|
2802
|
+
var mentionSchema = z21.discriminatedUnion("kind", [
|
|
2803
|
+
z21.object({
|
|
1661
2804
|
...range,
|
|
1662
|
-
kind:
|
|
1663
|
-
threadId:
|
|
1664
|
-
projectId:
|
|
2805
|
+
kind: z21.literal("thread"),
|
|
2806
|
+
threadId: z21.string(),
|
|
2807
|
+
projectId: z21.string().optional()
|
|
1665
2808
|
}),
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
2809
|
+
z21.object({ ...range, kind: z21.literal("project"), projectId: z21.string() }),
|
|
2810
|
+
z21.object({ ...range, kind: z21.literal("section"), sectionId: z21.string() }),
|
|
2811
|
+
z21.object({
|
|
1669
2812
|
...range,
|
|
1670
|
-
kind:
|
|
1671
|
-
path:
|
|
1672
|
-
source:
|
|
1673
|
-
entryKind:
|
|
2813
|
+
kind: z21.literal("path"),
|
|
2814
|
+
path: z21.string(),
|
|
2815
|
+
source: z21.enum(["workspace", "thread-storage"]),
|
|
2816
|
+
entryKind: z21.enum(["file", "directory"])
|
|
1674
2817
|
}),
|
|
1675
|
-
|
|
2818
|
+
z21.object({
|
|
1676
2819
|
...range,
|
|
1677
|
-
kind:
|
|
1678
|
-
trigger:
|
|
1679
|
-
name:
|
|
1680
|
-
source:
|
|
1681
|
-
origin:
|
|
1682
|
-
argumentHint:
|
|
2820
|
+
kind: z21.literal("command"),
|
|
2821
|
+
trigger: z21.enum(["/", "$"]),
|
|
2822
|
+
name: z21.string(),
|
|
2823
|
+
source: z21.enum(["skill", "command"]),
|
|
2824
|
+
origin: z21.enum(["builtin", "project", "user"]),
|
|
2825
|
+
argumentHint: z21.string().nullable()
|
|
1683
2826
|
}),
|
|
1684
|
-
|
|
1685
|
-
|
|
2827
|
+
z21.object({ ...range, kind: z21.literal("attachment"), path: z21.string() }),
|
|
2828
|
+
z21.object({
|
|
1686
2829
|
...range,
|
|
1687
|
-
kind:
|
|
1688
|
-
pluginId:
|
|
1689
|
-
provider:
|
|
1690
|
-
id:
|
|
1691
|
-
icon:
|
|
2830
|
+
kind: z21.literal("plugin"),
|
|
2831
|
+
pluginId: z21.string(),
|
|
2832
|
+
provider: z21.string().min(1).refine((value) => !value.includes(":")),
|
|
2833
|
+
id: z21.string(),
|
|
2834
|
+
icon: z21.string().nullable().optional()
|
|
1692
2835
|
})
|
|
1693
2836
|
]);
|
|
1694
2837
|
var attachmentFields = {
|
|
1695
|
-
type:
|
|
1696
|
-
path:
|
|
1697
|
-
name:
|
|
1698
|
-
mimeType:
|
|
1699
|
-
sizeBytes:
|
|
2838
|
+
type: z21.enum(["localImage", "localFile"]),
|
|
2839
|
+
path: z21.string().min(1),
|
|
2840
|
+
name: z21.string(),
|
|
2841
|
+
mimeType: z21.string().optional(),
|
|
2842
|
+
sizeBytes: z21.number().nonnegative().optional()
|
|
1700
2843
|
};
|
|
1701
|
-
var attachmentsSchema =
|
|
1702
|
-
|
|
1703
|
-
|
|
2844
|
+
var attachmentsSchema = z21.array(
|
|
2845
|
+
z21.union([
|
|
2846
|
+
z21.object({
|
|
1704
2847
|
...attachmentFields,
|
|
1705
|
-
hostId:
|
|
1706
|
-
sourceProjectId:
|
|
2848
|
+
hostId: z21.string().min(1),
|
|
2849
|
+
sourceProjectId: z21.undefined().optional()
|
|
1707
2850
|
}),
|
|
1708
|
-
|
|
2851
|
+
z21.object({
|
|
1709
2852
|
...attachmentFields,
|
|
1710
|
-
sourceProjectId:
|
|
1711
|
-
hostId:
|
|
2853
|
+
sourceProjectId: z21.string().min(1).optional(),
|
|
2854
|
+
hostId: z21.undefined().optional()
|
|
1712
2855
|
})
|
|
1713
2856
|
])
|
|
1714
2857
|
);
|
|
1715
|
-
var replacementSchema =
|
|
1716
|
-
text:
|
|
1717
|
-
mentions:
|
|
2858
|
+
var replacementSchema = z21.object({
|
|
2859
|
+
text: z21.string(),
|
|
2860
|
+
mentions: z21.array(mentionSchema),
|
|
1718
2861
|
attachments: attachmentsSchema.optional()
|
|
1719
2862
|
}).superRefine((draft, context) => {
|
|
1720
2863
|
let end = 0;
|
|
@@ -1957,7 +3100,7 @@ function createComposerHandleBinding(key, initial) {
|
|
|
1957
3100
|
throw new Error("Pick a time in the future.");
|
|
1958
3101
|
}
|
|
1959
3102
|
const errorBefore = editorState().attachmentError;
|
|
1960
|
-
await waitForUploads(target());
|
|
3103
|
+
if (editorState().isAttaching) await waitForUploads(target());
|
|
1961
3104
|
const state = editorState();
|
|
1962
3105
|
if (state.attachmentError !== null && state.attachmentError !== errorBefore) {
|
|
1963
3106
|
throw new Error(state.attachmentError);
|
|
@@ -2540,6 +3683,24 @@ var experimental_THREAD_ACTION_GROUPS = {
|
|
|
2540
3683
|
lifecycle: "4_lifecycle"
|
|
2541
3684
|
};
|
|
2542
3685
|
|
|
3686
|
+
// src/thread-info-groups.ts
|
|
3687
|
+
var experimental_THREAD_CONTEXT_SEGMENT_GROUPS = {
|
|
3688
|
+
thread: "1_thread",
|
|
3689
|
+
git: "3_git"
|
|
3690
|
+
};
|
|
3691
|
+
var experimental_THREAD_INFO_ROW_GROUPS = {
|
|
3692
|
+
thread: "1_thread",
|
|
3693
|
+
environment: "2_environment",
|
|
3694
|
+
git: "3_git",
|
|
3695
|
+
pullRequest: "4_pullRequest",
|
|
3696
|
+
lifecycle: "5_lifecycle"
|
|
3697
|
+
};
|
|
3698
|
+
var experimental_THREAD_INFO_SECTION_GROUPS = {
|
|
3699
|
+
related: "1_related",
|
|
3700
|
+
changes: "2_changes",
|
|
3701
|
+
storage: "3_storage"
|
|
3702
|
+
};
|
|
3703
|
+
|
|
2543
3704
|
// src/internal/sidebar-footer-runtime.ts
|
|
2544
3705
|
var sidebarFooterCommandSequence = 0;
|
|
2545
3706
|
var SidebarFooterItemRuntime = class {
|
|
@@ -2590,7 +3751,7 @@ function adaptSidebarFooterAction(registration) {
|
|
|
2590
3751
|
var sidebarFooterItemsByRegistrationSet = /* @__PURE__ */ new WeakMap();
|
|
2591
3752
|
|
|
2592
3753
|
// src/internal/plugin-app-registration-collector.ts
|
|
2593
|
-
import { z as
|
|
3754
|
+
import { z as z22 } from "zod";
|
|
2594
3755
|
var CODE_FENCE_LANGUAGE_PATTERN = /^[a-z0-9][a-z0-9+#._-]*$/;
|
|
2595
3756
|
var SIDEBAR_FOOTER_ACTION_KEYS = /* @__PURE__ */ new Set([
|
|
2596
3757
|
"id",
|
|
@@ -2706,8 +3867,8 @@ function checkStaleNavPanelKeys(kind, registration, onWarning) {
|
|
|
2706
3867
|
}
|
|
2707
3868
|
}
|
|
2708
3869
|
function createCommandShortcutSchema() {
|
|
2709
|
-
return
|
|
2710
|
-
key:
|
|
3870
|
+
return z22.object({
|
|
3871
|
+
key: z22.string().min(1).max(32).refine(
|
|
2711
3872
|
(key) => ![
|
|
2712
3873
|
"Alt",
|
|
2713
3874
|
"Control",
|
|
@@ -2718,16 +3879,23 @@ function createCommandShortcutSchema() {
|
|
|
2718
3879
|
"Unidentified"
|
|
2719
3880
|
].includes(key)
|
|
2720
3881
|
),
|
|
2721
|
-
mod:
|
|
2722
|
-
meta:
|
|
2723
|
-
control:
|
|
2724
|
-
alt:
|
|
2725
|
-
shift:
|
|
3882
|
+
mod: z22.boolean().default(false),
|
|
3883
|
+
meta: z22.boolean().default(false),
|
|
3884
|
+
control: z22.boolean().default(false),
|
|
3885
|
+
alt: z22.boolean().default(false),
|
|
3886
|
+
shift: z22.boolean().default(false)
|
|
2726
3887
|
}).strict().refine(
|
|
2727
3888
|
(shortcut) => shortcut.mod || shortcut.meta || shortcut.control || shortcut.alt || /^F(?:[1-9]|1[0-9]|2[0-4])$/u.test(shortcut.key),
|
|
2728
3889
|
"Use Command, Control, or Alt with a key, or a function key"
|
|
2729
3890
|
);
|
|
2730
3891
|
}
|
|
3892
|
+
function requireOptionalOrder(kind, order2) {
|
|
3893
|
+
if (order2 === void 0) return {};
|
|
3894
|
+
if (!Number.isFinite(order2)) {
|
|
3895
|
+
throw new Error(`${kind}: "order" must be a finite number`);
|
|
3896
|
+
}
|
|
3897
|
+
return { order: order2 };
|
|
3898
|
+
}
|
|
2731
3899
|
function collectTitledComponent(kind, seen, registration) {
|
|
2732
3900
|
const id = requireSlotId(kind, registration?.id);
|
|
2733
3901
|
requireUniqueId(kind, seen, id);
|
|
@@ -2769,7 +3937,12 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
2769
3937
|
settingsSections: [],
|
|
2770
3938
|
appOverlays: [],
|
|
2771
3939
|
navPanels: [],
|
|
2772
|
-
|
|
3940
|
+
tabs: [],
|
|
3941
|
+
get threadPanelActions() {
|
|
3942
|
+
return this.tabs.filter(
|
|
3943
|
+
(tab) => tab.context.kind === "thread" && tab.availability === "action"
|
|
3944
|
+
);
|
|
3945
|
+
},
|
|
2773
3946
|
newThreadPanelActions: [],
|
|
2774
3947
|
composerCustomizations: [],
|
|
2775
3948
|
pendingInteractions: [],
|
|
@@ -2778,11 +3951,15 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
2778
3951
|
threadLists: [],
|
|
2779
3952
|
experimentalSidebarNavigations: [],
|
|
2780
3953
|
threadHeaderActions: [],
|
|
3954
|
+
threadContextSegments: [],
|
|
3955
|
+
threadInfoRows: [],
|
|
3956
|
+
threadInfoSections: [],
|
|
2781
3957
|
threadActions: [],
|
|
2782
3958
|
browserToolbarActions: [],
|
|
2783
3959
|
fileOpeners: [],
|
|
2784
3960
|
sourceCodeRenderers: [],
|
|
2785
3961
|
diffRenderers: [],
|
|
3962
|
+
composers: [],
|
|
2786
3963
|
messageDirectives: [],
|
|
2787
3964
|
codeFenceRenderers: [],
|
|
2788
3965
|
messageActions: [],
|
|
@@ -2800,7 +3977,7 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
2800
3977
|
settingsSection: /* @__PURE__ */ new Set(),
|
|
2801
3978
|
appOverlay: /* @__PURE__ */ new Set(),
|
|
2802
3979
|
navPanel: /* @__PURE__ */ new Set(),
|
|
2803
|
-
|
|
3980
|
+
tab: /* @__PURE__ */ new Set(),
|
|
2804
3981
|
newThreadPanelAction: /* @__PURE__ */ new Set(),
|
|
2805
3982
|
composerCustomization: /* @__PURE__ */ new Set(),
|
|
2806
3983
|
composerPopup: /* @__PURE__ */ new Set(),
|
|
@@ -2810,11 +3987,15 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
2810
3987
|
sidebarNavigation: /* @__PURE__ */ new Set(),
|
|
2811
3988
|
sidebarHeader: /* @__PURE__ */ new Set(),
|
|
2812
3989
|
threadHeaderAction: /* @__PURE__ */ new Set(),
|
|
3990
|
+
threadContextSegment: /* @__PURE__ */ new Set(),
|
|
3991
|
+
threadInfoRow: /* @__PURE__ */ new Set(),
|
|
3992
|
+
threadInfoSection: /* @__PURE__ */ new Set(),
|
|
2813
3993
|
threadAction: /* @__PURE__ */ new Set(),
|
|
2814
3994
|
browserToolbarAction: /* @__PURE__ */ new Set(),
|
|
2815
3995
|
fileOpener: /* @__PURE__ */ new Set(),
|
|
2816
3996
|
sourceCodeRenderer: /* @__PURE__ */ new Set(),
|
|
2817
3997
|
diffRenderer: /* @__PURE__ */ new Set(),
|
|
3998
|
+
composer: /* @__PURE__ */ new Set(),
|
|
2818
3999
|
messageDirective: /* @__PURE__ */ new Set(),
|
|
2819
4000
|
codeFenceRenderer: /* @__PURE__ */ new Set(),
|
|
2820
4001
|
codeFenceLanguage: /* @__PURE__ */ new Set(),
|
|
@@ -2826,6 +4007,54 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
2826
4007
|
machineProviderInputs: /* @__PURE__ */ new Set(),
|
|
2827
4008
|
contentScript: /* @__PURE__ */ new Set()
|
|
2828
4009
|
};
|
|
4010
|
+
function collectTab(value, legacy = false) {
|
|
4011
|
+
const registration = value;
|
|
4012
|
+
const kind = "slots.experimental_tab";
|
|
4013
|
+
const id = requireSlotId(kind, registration?.id);
|
|
4014
|
+
const context = registration.context;
|
|
4015
|
+
if (context?.kind !== "thread" && context?.kind !== "nav-panel") {
|
|
4016
|
+
throw new Error(`${kind}: context must be thread or nav-panel`);
|
|
4017
|
+
}
|
|
4018
|
+
if (context.kind === "nav-panel") requireSlotId(kind, context.panelId);
|
|
4019
|
+
const availability = registration.availability;
|
|
4020
|
+
if (availability !== "fixed" && availability !== "action") {
|
|
4021
|
+
throw new Error(`${kind}: availability must be fixed or action`);
|
|
4022
|
+
}
|
|
4023
|
+
requireUniqueId(
|
|
4024
|
+
kind,
|
|
4025
|
+
seenIds.tab,
|
|
4026
|
+
`${context.kind}/${context.kind === "nav-panel" ? context.panelId : ""}/${id}`
|
|
4027
|
+
);
|
|
4028
|
+
if (registration.useVisible !== void 0 && typeof registration.useVisible !== "function") {
|
|
4029
|
+
throw new Error(`${kind}: useVisible must be a function`);
|
|
4030
|
+
}
|
|
4031
|
+
if (availability === "fixed" && (registration.run !== void 0 || registration.params !== void 0)) {
|
|
4032
|
+
throw new Error(`${kind}: run and params require action availability`);
|
|
4033
|
+
}
|
|
4034
|
+
const target = registration.experimental_target;
|
|
4035
|
+
if (target !== void 0 && (context.kind !== "nav-panel" || availability !== "fixed" || typeof target?.validate !== "function")) {
|
|
4036
|
+
throw new Error(
|
|
4037
|
+
`${kind}: experimental_target requires a nav-panel fixed tab and a validate function`
|
|
4038
|
+
);
|
|
4039
|
+
}
|
|
4040
|
+
const validated = {
|
|
4041
|
+
...registration,
|
|
4042
|
+
...collectPanelAction(kind, /* @__PURE__ */ new Set(), {
|
|
4043
|
+
...registration,
|
|
4044
|
+
icon: legacy && registration.icon === "" ? void 0 : registration.icon
|
|
4045
|
+
}),
|
|
4046
|
+
icon: legacy && registration.icon === "" ? "" : requireNonEmptyString(kind, "icon", registration.icon),
|
|
4047
|
+
...registration.tooltip === void 0 ? {} : {
|
|
4048
|
+
tooltip: requireNonEmptyString(
|
|
4049
|
+
kind,
|
|
4050
|
+
"tooltip",
|
|
4051
|
+
registration.tooltip
|
|
4052
|
+
)
|
|
4053
|
+
},
|
|
4054
|
+
...availability === "action" && registration.params !== void 0 ? { params: z22.json().parse(registration.params) } : {}
|
|
4055
|
+
};
|
|
4056
|
+
collected.tabs.push(validated);
|
|
4057
|
+
}
|
|
2829
4058
|
function collectCommand(kind, registration) {
|
|
2830
4059
|
const id = requireSlotId(kind, registration?.id);
|
|
2831
4060
|
requireUniqueId(kind, seenIds.command, id);
|
|
@@ -2860,6 +4089,26 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
2860
4089
|
}
|
|
2861
4090
|
const legacySidebarHeaders = [];
|
|
2862
4091
|
const legacySlotAliases = {
|
|
4092
|
+
threadPanelAction(registration) {
|
|
4093
|
+
try {
|
|
4094
|
+
const action = collectPanelAction(
|
|
4095
|
+
"slots.threadPanelAction",
|
|
4096
|
+
/* @__PURE__ */ new Set(),
|
|
4097
|
+
registration
|
|
4098
|
+
);
|
|
4099
|
+
collectTab(
|
|
4100
|
+
{
|
|
4101
|
+
...action,
|
|
4102
|
+
icon: action.icon ?? "",
|
|
4103
|
+
context: { kind: "thread" },
|
|
4104
|
+
availability: "action"
|
|
4105
|
+
},
|
|
4106
|
+
true
|
|
4107
|
+
);
|
|
4108
|
+
} catch (error) {
|
|
4109
|
+
onWarning(`Legacy threadPanelAction ignored: ${String(error)}`);
|
|
4110
|
+
}
|
|
4111
|
+
},
|
|
2863
4112
|
experimental_sidebarHeader(registration) {
|
|
2864
4113
|
legacySidebarHeaders.push(
|
|
2865
4114
|
collectTitledComponent(
|
|
@@ -2947,63 +4196,45 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
2947
4196
|
`${kind}: "experimental_usePageTitle" must be a React hook function when set`
|
|
2948
4197
|
);
|
|
2949
4198
|
}
|
|
2950
|
-
const
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
const
|
|
2958
|
-
const
|
|
2959
|
-
const id2 = requireSlotId(fixedTabKind, fixedTab?.id);
|
|
2960
|
-
requireUniqueId(fixedTabKind, seenFixedTabIds, id2);
|
|
2961
|
-
const layout = fixedTab?.layout;
|
|
2962
|
-
if (layout !== void 0 && layout !== "padded" && layout !== "flush") {
|
|
2963
|
-
throw new Error(
|
|
2964
|
-
`${fixedTabKind}: "layout" must be "padded" or "flush" when set`
|
|
2965
|
-
);
|
|
2966
|
-
}
|
|
2967
|
-
const fixedTabPanelId = requireNonEmptyString(
|
|
2968
|
-
fixedTabKind,
|
|
2969
|
-
"panelId",
|
|
2970
|
-
fixedTab?.panelId
|
|
2971
|
-
);
|
|
2972
|
-
if (fixedTabPanelId !== panelId) {
|
|
2973
|
-
throw new Error(
|
|
2974
|
-
`${fixedTabKind}: "panelId" must match its containing navPanel id ${JSON.stringify(panelId)}`
|
|
2975
|
-
);
|
|
2976
|
-
}
|
|
2977
|
-
const experimentalTarget = fixedTab?.experimental_target;
|
|
2978
|
-
if (experimentalTarget !== void 0 && (typeof experimentalTarget !== "object" || experimentalTarget === null || typeof Reflect.get(experimentalTarget, "validate") !== "function")) {
|
|
2979
|
-
throw new Error(
|
|
2980
|
-
`${fixedTabKind}: "experimental_target.validate" must be a function when set`
|
|
2981
|
-
);
|
|
2982
|
-
}
|
|
2983
|
-
return {
|
|
4199
|
+
const legacy = registration;
|
|
4200
|
+
const fixedTabs = [];
|
|
4201
|
+
if (legacy.fixedTabs !== void 0 && !Array.isArray(legacy.fixedTabs)) {
|
|
4202
|
+
onWarning("Legacy navPanel.fixedTabs ignored: expected an array");
|
|
4203
|
+
}
|
|
4204
|
+
for (const value of Array.isArray(legacy.fixedTabs) ? legacy.fixedTabs : []) {
|
|
4205
|
+
try {
|
|
4206
|
+
const id2 = requireSlotId(kind, value?.id);
|
|
4207
|
+
const tab = {
|
|
2984
4208
|
id: id2,
|
|
2985
|
-
panelId
|
|
2986
|
-
title: requireNonEmptyString(
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
icon: requireNonEmptyString(fixedTabKind, "icon", fixedTab?.icon),
|
|
2992
|
-
component: requireComponent(fixedTabKind, fixedTab?.component),
|
|
2993
|
-
...layout === void 0 ? {} : { layout },
|
|
2994
|
-
...experimentalTarget === void 0 ? {} : {
|
|
2995
|
-
experimental_target: experimentalTarget
|
|
2996
|
-
}
|
|
4209
|
+
panelId,
|
|
4210
|
+
title: requireNonEmptyString(kind, "title", value.title ?? id2),
|
|
4211
|
+
icon: typeof value.icon === "string" ? value.icon : "",
|
|
4212
|
+
component: requireComponent(kind, value.component),
|
|
4213
|
+
...value.layout === "flush" ? { layout: "flush" } : {},
|
|
4214
|
+
...typeof value.experimental_target?.validate === "function" ? { experimental_target: value.experimental_target } : {}
|
|
2997
4215
|
};
|
|
2998
|
-
|
|
2999
|
-
|
|
4216
|
+
collectTab(
|
|
4217
|
+
{
|
|
4218
|
+
...tab,
|
|
4219
|
+
context: { kind: "nav-panel", panelId },
|
|
4220
|
+
availability: "fixed"
|
|
4221
|
+
},
|
|
4222
|
+
true
|
|
4223
|
+
);
|
|
4224
|
+
fixedTabs.push(tab);
|
|
4225
|
+
} catch (error) {
|
|
4226
|
+
onWarning(
|
|
4227
|
+
`Legacy navPanel.fixedTabs entry ignored: ${String(error)}`
|
|
4228
|
+
);
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
3000
4231
|
collected.navPanels.push({
|
|
3001
4232
|
id,
|
|
3002
4233
|
title: requireNonEmptyString(kind, "title", registration.title),
|
|
3003
4234
|
icon: requireNonEmptyString(kind, "icon", registration.icon),
|
|
3004
4235
|
path,
|
|
4236
|
+
...fixedTabs.length === 0 ? {} : { fixedTabs },
|
|
3005
4237
|
component: requireComponent(kind, registration.component),
|
|
3006
|
-
...fixedTabs.length > 0 ? { fixedTabs } : {},
|
|
3007
4238
|
...registration.experimental_useBadge !== void 0 ? {
|
|
3008
4239
|
experimental_useBadge: registration.experimental_useBadge
|
|
3009
4240
|
} : {},
|
|
@@ -3014,14 +4245,8 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
3014
4245
|
...registration.headerContent !== void 0 ? { headerContent: registration.headerContent } : {}
|
|
3015
4246
|
});
|
|
3016
4247
|
},
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
collectPanelAction(
|
|
3020
|
-
"slots.threadPanelAction",
|
|
3021
|
-
seenIds.threadPanelAction,
|
|
3022
|
-
registration
|
|
3023
|
-
)
|
|
3024
|
-
);
|
|
4248
|
+
experimental_tab(registration) {
|
|
4249
|
+
collectTab(registration);
|
|
3025
4250
|
},
|
|
3026
4251
|
experimental_newThreadPanelAction(registration) {
|
|
3027
4252
|
collected.newThreadPanelActions.push(
|
|
@@ -3099,6 +4324,61 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
3099
4324
|
component: requireComponent(kind, registration.component)
|
|
3100
4325
|
});
|
|
3101
4326
|
},
|
|
4327
|
+
experimental_threadContextSegment(registration) {
|
|
4328
|
+
const kind = "slots.experimental_threadContextSegment";
|
|
4329
|
+
const id = requireSlotId(kind, registration?.id);
|
|
4330
|
+
requireUniqueId(kind, seenIds.threadContextSegment, id);
|
|
4331
|
+
const optionalComponent = (field) => {
|
|
4332
|
+
const value = registration[field];
|
|
4333
|
+
if (value === void 0) return {};
|
|
4334
|
+
if (typeof value !== "function") {
|
|
4335
|
+
throw new Error(
|
|
4336
|
+
`${kind}: "${field}" must be a React component function`
|
|
4337
|
+
);
|
|
4338
|
+
}
|
|
4339
|
+
return { [field]: value };
|
|
4340
|
+
};
|
|
4341
|
+
if (typeof registration.summary !== "function") {
|
|
4342
|
+
throw new Error(
|
|
4343
|
+
`${kind}: "summary" must be a React component function`
|
|
4344
|
+
);
|
|
4345
|
+
}
|
|
4346
|
+
if (registration.useVisible !== void 0 && typeof registration.useVisible !== "function") {
|
|
4347
|
+
throw new Error(`${kind}: "useVisible" must be a function`);
|
|
4348
|
+
}
|
|
4349
|
+
collected.threadContextSegments.push({
|
|
4350
|
+
id,
|
|
4351
|
+
title: requireNonEmptyString(kind, "title", registration.title),
|
|
4352
|
+
group: requireNonEmptyString(kind, "group", registration.group),
|
|
4353
|
+
...requireOptionalOrder(kind, registration.order),
|
|
4354
|
+
summary: registration.summary,
|
|
4355
|
+
...optionalComponent("action"),
|
|
4356
|
+
...optionalComponent("details"),
|
|
4357
|
+
...registration.useVisible !== void 0 ? { useVisible: registration.useVisible } : {}
|
|
4358
|
+
});
|
|
4359
|
+
},
|
|
4360
|
+
experimental_threadInfoRow(registration) {
|
|
4361
|
+
const kind = "slots.experimental_threadInfoRow";
|
|
4362
|
+
const id = requireSlotId(kind, registration?.id);
|
|
4363
|
+
requireUniqueId(kind, seenIds.threadInfoRow, id);
|
|
4364
|
+
collected.threadInfoRows.push({
|
|
4365
|
+
id,
|
|
4366
|
+
group: requireNonEmptyString(kind, "group", registration.group),
|
|
4367
|
+
...requireOptionalOrder(kind, registration.order),
|
|
4368
|
+
component: requireComponent(kind, registration.component)
|
|
4369
|
+
});
|
|
4370
|
+
},
|
|
4371
|
+
experimental_threadInfoSection(registration) {
|
|
4372
|
+
const kind = "slots.experimental_threadInfoSection";
|
|
4373
|
+
const id = requireSlotId(kind, registration?.id);
|
|
4374
|
+
requireUniqueId(kind, seenIds.threadInfoSection, id);
|
|
4375
|
+
collected.threadInfoSections.push({
|
|
4376
|
+
id,
|
|
4377
|
+
group: requireNonEmptyString(kind, "group", registration.group),
|
|
4378
|
+
...requireOptionalOrder(kind, registration.order),
|
|
4379
|
+
component: requireComponent(kind, registration.component)
|
|
4380
|
+
});
|
|
4381
|
+
},
|
|
3102
4382
|
experimental_threadAction(registration) {
|
|
3103
4383
|
const kind = "slots.experimental_threadAction";
|
|
3104
4384
|
const id = requireSlotId(kind, registration?.id);
|
|
@@ -3109,15 +4389,12 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
3109
4389
|
if (registration.useData !== void 0 && typeof registration.useData !== "function") {
|
|
3110
4390
|
throw new Error(`${kind}: "useData" must be a function`);
|
|
3111
4391
|
}
|
|
3112
|
-
if (registration.order !== void 0 && !Number.isFinite(registration.order)) {
|
|
3113
|
-
throw new Error(`${kind}: "order" must be a finite number`);
|
|
3114
|
-
}
|
|
3115
4392
|
collected.threadActions.push({
|
|
3116
4393
|
id,
|
|
3117
4394
|
title: requireNonEmptyString(kind, "title", registration.title),
|
|
3118
4395
|
icon: requireNonEmptyString(kind, "icon", registration.icon),
|
|
3119
4396
|
group: requireNonEmptyString(kind, "group", registration.group),
|
|
3120
|
-
...
|
|
4397
|
+
...requireOptionalOrder(kind, registration.order),
|
|
3121
4398
|
...registration.useData !== void 0 ? { useData: registration.useData } : {},
|
|
3122
4399
|
item: registration.item
|
|
3123
4400
|
});
|
|
@@ -3175,6 +4452,15 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
3175
4452
|
)
|
|
3176
4453
|
);
|
|
3177
4454
|
},
|
|
4455
|
+
experimental_composer(registration) {
|
|
4456
|
+
collected.composers.push(
|
|
4457
|
+
collectTitledComponent(
|
|
4458
|
+
"slots.experimental_composer",
|
|
4459
|
+
seenIds.composer,
|
|
4460
|
+
registration
|
|
4461
|
+
)
|
|
4462
|
+
);
|
|
4463
|
+
},
|
|
3178
4464
|
messageDirective(registration) {
|
|
3179
4465
|
const kind = "slots.messageDirective";
|
|
3180
4466
|
const id = requireMessageDirectiveId(kind, registration?.id);
|
|
@@ -3368,7 +4654,7 @@ function attachLegacySidebarHeaders(navigations, headers, onWarning) {
|
|
|
3368
4654
|
}
|
|
3369
4655
|
|
|
3370
4656
|
// src/testing/app.tsx
|
|
3371
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4657
|
+
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
3372
4658
|
function TestSidebarNavigationIcon({
|
|
3373
4659
|
icon,
|
|
3374
4660
|
className
|
|
@@ -3996,6 +5282,106 @@ function TestPermissionModePicker({
|
|
|
3996
5282
|
}
|
|
3997
5283
|
);
|
|
3998
5284
|
}
|
|
5285
|
+
function TestComposerRoot(_props) {
|
|
5286
|
+
return null;
|
|
5287
|
+
}
|
|
5288
|
+
function TestComposerPluginActions() {
|
|
5289
|
+
return null;
|
|
5290
|
+
}
|
|
5291
|
+
function TestComposerPluginPopup({
|
|
5292
|
+
contribution
|
|
5293
|
+
}) {
|
|
5294
|
+
return /* @__PURE__ */ jsx(contribution.popup.component, {});
|
|
5295
|
+
}
|
|
5296
|
+
function TestComposerMenuEntry({
|
|
5297
|
+
contribution
|
|
5298
|
+
}) {
|
|
5299
|
+
return /* @__PURE__ */ jsx("div", { role: "menuitem", children: contribution.item.label });
|
|
5300
|
+
}
|
|
5301
|
+
var IDLE_COMPOSER_MENTION_SEARCH = {
|
|
5302
|
+
status: "idle",
|
|
5303
|
+
refreshing: false,
|
|
5304
|
+
groups: [],
|
|
5305
|
+
search: () => {
|
|
5306
|
+
}
|
|
5307
|
+
};
|
|
5308
|
+
var IDLE_COMPOSER_COMMAND_SEARCH = {
|
|
5309
|
+
status: "idle",
|
|
5310
|
+
refreshing: false,
|
|
5311
|
+
groups: [],
|
|
5312
|
+
search: () => {
|
|
5313
|
+
}
|
|
5314
|
+
};
|
|
5315
|
+
var TEST_COMPOSER_CONTRIBUTIONS = {
|
|
5316
|
+
popups: [],
|
|
5317
|
+
plusMenuItems: [],
|
|
5318
|
+
sendMenuItems: [],
|
|
5319
|
+
Actions: TestComposerPluginActions,
|
|
5320
|
+
Popup: TestComposerPluginPopup,
|
|
5321
|
+
MenuEntry: TestComposerMenuEntry
|
|
5322
|
+
};
|
|
5323
|
+
function TestVoiceInputButton({
|
|
5324
|
+
warning: _warning,
|
|
5325
|
+
variant: _variant,
|
|
5326
|
+
size: _size,
|
|
5327
|
+
...props
|
|
5328
|
+
}) {
|
|
5329
|
+
return /* @__PURE__ */ jsx("button", { ...props });
|
|
5330
|
+
}
|
|
5331
|
+
function TestVoiceRecordingBar({
|
|
5332
|
+
state,
|
|
5333
|
+
onConfirm,
|
|
5334
|
+
onCancel
|
|
5335
|
+
}) {
|
|
5336
|
+
return /* @__PURE__ */ jsxs("div", { "data-voice-recording-state": state, children: [
|
|
5337
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: onConfirm, children: "Finish voice input" }),
|
|
5338
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: onCancel, children: "Cancel voice input" })
|
|
5339
|
+
] });
|
|
5340
|
+
}
|
|
5341
|
+
function TestFailedVoiceRecordings({
|
|
5342
|
+
recordings,
|
|
5343
|
+
className
|
|
5344
|
+
}) {
|
|
5345
|
+
return /* @__PURE__ */ jsx("ul", { className, children: recordings.map((recording) => /* @__PURE__ */ jsx("li", { children: recording.errorMessage }, recording.id)) });
|
|
5346
|
+
}
|
|
5347
|
+
function TestShortcutHint({
|
|
5348
|
+
shortcut,
|
|
5349
|
+
className
|
|
5350
|
+
}) {
|
|
5351
|
+
return shortcut === null ? null : /* @__PURE__ */ jsx("kbd", { className, children: shortcut.label });
|
|
5352
|
+
}
|
|
5353
|
+
function TestImageLightbox({
|
|
5354
|
+
imageSrc,
|
|
5355
|
+
imageAlt,
|
|
5356
|
+
isOpen
|
|
5357
|
+
}) {
|
|
5358
|
+
const visible = isOpen ?? imageSrc !== null;
|
|
5359
|
+
return visible && imageSrc !== null ? /* @__PURE__ */ jsx("img", { alt: imageAlt, src: imageSrc }) : null;
|
|
5360
|
+
}
|
|
5361
|
+
function TestPromptMentionIcon({
|
|
5362
|
+
className
|
|
5363
|
+
}) {
|
|
5364
|
+
return /* @__PURE__ */ jsx("span", { className, "aria-hidden": true });
|
|
5365
|
+
}
|
|
5366
|
+
var TEST_PROMPT_MENTION_ATTRIBUTE = "data-test-prompt-mention";
|
|
5367
|
+
function testPromptMentionClipboardAttributes(mention, text) {
|
|
5368
|
+
return { [TEST_PROMPT_MENTION_ATTRIBUTE]: JSON.stringify({ mention, text }) };
|
|
5369
|
+
}
|
|
5370
|
+
function readTestPromptMentionClipboard(element) {
|
|
5371
|
+
const value = element.getAttribute(TEST_PROMPT_MENTION_ATTRIBUTE);
|
|
5372
|
+
if (value === null) return null;
|
|
5373
|
+
const pill = JSON.parse(value);
|
|
5374
|
+
return pill;
|
|
5375
|
+
}
|
|
5376
|
+
function TestPluginIcon({ className }) {
|
|
5377
|
+
return /* @__PURE__ */ jsx("span", { className, "aria-hidden": true });
|
|
5378
|
+
}
|
|
5379
|
+
function TestThreadTitleText({
|
|
5380
|
+
title,
|
|
5381
|
+
className
|
|
5382
|
+
}) {
|
|
5383
|
+
return /* @__PURE__ */ jsx("span", { className, children: title });
|
|
5384
|
+
}
|
|
3999
5385
|
function TestVoiceInputTextarea({
|
|
4000
5386
|
onValueChange,
|
|
4001
5387
|
onVoiceInputActiveChange: _onVoiceInputActiveChange,
|
|
@@ -4051,6 +5437,52 @@ function TestDiff({
|
|
|
4051
5437
|
}
|
|
4052
5438
|
);
|
|
4053
5439
|
}
|
|
5440
|
+
function TestInfoSection({
|
|
5441
|
+
label,
|
|
5442
|
+
count,
|
|
5443
|
+
accessory,
|
|
5444
|
+
trailing,
|
|
5445
|
+
children
|
|
5446
|
+
}) {
|
|
5447
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": label, "data-testid": "bb-info-section", children: [
|
|
5448
|
+
/* @__PURE__ */ jsxs("h3", { children: [
|
|
5449
|
+
label,
|
|
5450
|
+
count === void 0 ? null : /* @__PURE__ */ jsx("span", { children: count })
|
|
5451
|
+
] }),
|
|
5452
|
+
accessory,
|
|
5453
|
+
trailing,
|
|
5454
|
+
children
|
|
5455
|
+
] });
|
|
5456
|
+
}
|
|
5457
|
+
function TestDetailRow({ label, icon, children }) {
|
|
5458
|
+
return /* @__PURE__ */ jsxs("div", { "data-testid": "bb-detail-row", "data-icon": icon, children: [
|
|
5459
|
+
/* @__PURE__ */ jsx("dt", { children: label }),
|
|
5460
|
+
/* @__PURE__ */ jsx("dd", { children })
|
|
5461
|
+
] });
|
|
5462
|
+
}
|
|
5463
|
+
function TestInfoList({
|
|
5464
|
+
items,
|
|
5465
|
+
getKey,
|
|
5466
|
+
renderItem,
|
|
5467
|
+
limit
|
|
5468
|
+
}) {
|
|
5469
|
+
return /* @__PURE__ */ jsx("ul", { "data-limit": limit, children: items.map((item) => /* @__PURE__ */ jsx(Fragment, { children: renderItem(item) }, getKey(item))) });
|
|
5470
|
+
}
|
|
5471
|
+
function TestInfoListRow({
|
|
5472
|
+
leading,
|
|
5473
|
+
name,
|
|
5474
|
+
title,
|
|
5475
|
+
context,
|
|
5476
|
+
trailing,
|
|
5477
|
+
onSelect
|
|
5478
|
+
}) {
|
|
5479
|
+
return /* @__PURE__ */ jsxs("li", { children: [
|
|
5480
|
+
leading,
|
|
5481
|
+
onSelect === void 0 ? /* @__PURE__ */ jsx("span", { title, children: name }) : /* @__PURE__ */ jsx("button", { type: "button", title, onClick: onSelect, children: name }),
|
|
5482
|
+
context === void 0 ? null : /* @__PURE__ */ jsx("span", { children: context }),
|
|
5483
|
+
trailing
|
|
5484
|
+
] });
|
|
5485
|
+
}
|
|
4054
5486
|
var activeClipboard = null;
|
|
4055
5487
|
function captureClipboardWrites(result) {
|
|
4056
5488
|
const writes = [];
|
|
@@ -4120,7 +5552,7 @@ var testPluginSdkApp = {
|
|
|
4120
5552
|
store.getSnapshot,
|
|
4121
5553
|
store.getSnapshot
|
|
4122
5554
|
);
|
|
4123
|
-
if (state === null || state.panelId !== tab.panelId || state.tabId !== tab.id || tab.experimental_target === void 0) {
|
|
5555
|
+
if (state === null || state.panelId !== ("context" in tab ? tab.context.panelId : tab.panelId) || state.tabId !== tab.id || tab.experimental_target === void 0) {
|
|
4124
5556
|
return null;
|
|
4125
5557
|
}
|
|
4126
5558
|
try {
|
|
@@ -4176,6 +5608,27 @@ var testPluginSdkApp = {
|
|
|
4176
5608
|
UrlLink: TestUrlLink,
|
|
4177
5609
|
experimental_NewThreadComposer: TestNewThreadComposer,
|
|
4178
5610
|
experimental_VoiceInputTextarea: TestVoiceInputTextarea,
|
|
5611
|
+
experimental_ComposerRoot: TestComposerRoot,
|
|
5612
|
+
experimental_VoiceInputButton: TestVoiceInputButton,
|
|
5613
|
+
experimental_VoiceRecordingBar: TestVoiceRecordingBar,
|
|
5614
|
+
experimental_FailedVoiceRecordings: TestFailedVoiceRecordings,
|
|
5615
|
+
experimental_ShortcutHint: TestShortcutHint,
|
|
5616
|
+
experimental_ImageLightbox: TestImageLightbox,
|
|
5617
|
+
experimental_PromptMentionIcon: TestPromptMentionIcon,
|
|
5618
|
+
experimental_describePromptMention(mention) {
|
|
5619
|
+
return {
|
|
5620
|
+
className: "prompt-mention-pill",
|
|
5621
|
+
title: mention.label,
|
|
5622
|
+
text: `${mention.kind}: ${mention.label}`
|
|
5623
|
+
};
|
|
5624
|
+
},
|
|
5625
|
+
experimental_promptMentionClipboardAttributes: testPromptMentionClipboardAttributes,
|
|
5626
|
+
experimental_readPromptMentionClipboard: readTestPromptMentionClipboard,
|
|
5627
|
+
experimental_PluginIcon: TestPluginIcon,
|
|
5628
|
+
experimental_ThreadTitleText: TestThreadTitleText,
|
|
5629
|
+
experimental_useThreadTitleDisplayText(title) {
|
|
5630
|
+
return title;
|
|
5631
|
+
},
|
|
4179
5632
|
experimental_ProviderModelPicker: TestProviderModelPicker,
|
|
4180
5633
|
experimental_PermissionModePicker: TestPermissionModePicker,
|
|
4181
5634
|
experimental_BranchPicker: TestBranchPicker,
|
|
@@ -4187,6 +5640,10 @@ var testPluginSdkApp = {
|
|
|
4187
5640
|
},
|
|
4188
5641
|
experimental_SourceCode: TestSourceCode,
|
|
4189
5642
|
experimental_Diff: TestDiff,
|
|
5643
|
+
experimental_InfoSection: TestInfoSection,
|
|
5644
|
+
experimental_DetailRow: TestDetailRow,
|
|
5645
|
+
experimental_InfoList: TestInfoList,
|
|
5646
|
+
experimental_InfoListRow: TestInfoListRow,
|
|
4190
5647
|
experimental_useSidebarThreads() {
|
|
4191
5648
|
return useSlotEnv("experimental_useSidebarThreads").sidebarThreads;
|
|
4192
5649
|
},
|
|
@@ -4230,6 +5687,9 @@ var testPluginSdkApp = {
|
|
|
4230
5687
|
experimental_ThreadActionsContextMenu: TestThreadActionsContextMenu,
|
|
4231
5688
|
experimental_PluginRpcCallError,
|
|
4232
5689
|
experimental_THREAD_ACTION_GROUPS,
|
|
5690
|
+
experimental_THREAD_CONTEXT_SEGMENT_GROUPS,
|
|
5691
|
+
experimental_THREAD_INFO_ROW_GROUPS,
|
|
5692
|
+
experimental_THREAD_INFO_SECTION_GROUPS,
|
|
4233
5693
|
experimental_useSidebarNavigation() {
|
|
4234
5694
|
return useSlotEnv("experimental_useSidebarNavigation").sidebarNavigation;
|
|
4235
5695
|
},
|
|
@@ -4301,15 +5761,30 @@ var testPluginSdkApp = {
|
|
|
4301
5761
|
useSdk() {
|
|
4302
5762
|
return useSlotEnv("useSdk").sdk;
|
|
4303
5763
|
},
|
|
4304
|
-
|
|
4305
|
-
const
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
5764
|
+
experimental_useComposerRenderer() {
|
|
5765
|
+
const renderer = useSlotEnv(
|
|
5766
|
+
"experimental_useComposerRenderer"
|
|
5767
|
+
).composerRenderer;
|
|
5768
|
+
if (renderer === null) {
|
|
5769
|
+
throw new Error(
|
|
5770
|
+
"experimental_useComposerRenderer() is only available inside an experimental_composer component; pass composerRenderer to mount it as one."
|
|
5771
|
+
);
|
|
5772
|
+
}
|
|
5773
|
+
return renderer;
|
|
5774
|
+
},
|
|
5775
|
+
experimental_useComposerContributions() {
|
|
5776
|
+
if (useSlotEnv("experimental_useComposerContributions").composerRenderer === null) {
|
|
5777
|
+
throw new Error(
|
|
5778
|
+
"experimental_useComposerContributions() is only available inside an experimental_composer component; pass composerRenderer to mount it as one."
|
|
5779
|
+
);
|
|
5780
|
+
}
|
|
5781
|
+
return TEST_COMPOSER_CONTRIBUTIONS;
|
|
5782
|
+
},
|
|
5783
|
+
experimental_useComposerMentionSearch() {
|
|
5784
|
+
return IDLE_COMPOSER_MENTION_SEARCH;
|
|
5785
|
+
},
|
|
5786
|
+
experimental_useComposerCommandSearch() {
|
|
5787
|
+
return IDLE_COMPOSER_COMMAND_SEARCH;
|
|
4313
5788
|
},
|
|
4314
5789
|
useComposerView() {
|
|
4315
5790
|
const composer = useSlotEnv("useComposerView").composer;
|
|
@@ -4501,7 +5976,9 @@ function renderSlot(registration, props, options = {}) {
|
|
|
4501
5976
|
});
|
|
4502
5977
|
return parsed.value;
|
|
4503
5978
|
};
|
|
4504
|
-
const queryClient = new QueryClient(
|
|
5979
|
+
const queryClient = new QueryClient({
|
|
5980
|
+
defaultOptions: { queries: { retry: false } }
|
|
5981
|
+
});
|
|
4505
5982
|
const callRpc2 = async (method, input) => {
|
|
4506
5983
|
const normalizedInput = input === void 0 ? null : strictJsonRoundTrip(input, `rpc "${method}" input`);
|
|
4507
5984
|
rpcCalls.push({ method, input: normalizedInput });
|
|
@@ -4543,6 +6020,7 @@ function renderSlot(registration, props, options = {}) {
|
|
|
4543
6020
|
};
|
|
4544
6021
|
const navigateCalls = [];
|
|
4545
6022
|
const experimental_fixedTabOpenCalls = [];
|
|
6023
|
+
const experimental_tabOpenCalls = [];
|
|
4546
6024
|
let fixedTabTargetSnapshot = options.experimental_fixedTabTarget === void 0 ? null : {
|
|
4547
6025
|
panelId: options.experimental_fixedTabTarget.panelId,
|
|
4548
6026
|
sequence: 1,
|
|
@@ -4565,7 +6043,55 @@ function renderSlot(registration, props, options = {}) {
|
|
|
4565
6043
|
for (const listener of fixedTabTargetListeners) listener();
|
|
4566
6044
|
}
|
|
4567
6045
|
};
|
|
6046
|
+
function captureFixedTabOpen(surface, panelId, tabId, target) {
|
|
6047
|
+
const call = {
|
|
6048
|
+
surface,
|
|
6049
|
+
...panelId === void 0 ? {} : { panelId },
|
|
6050
|
+
tabId,
|
|
6051
|
+
...target === void 0 ? {} : { target }
|
|
6052
|
+
};
|
|
6053
|
+
experimental_fixedTabOpenCalls.push(call);
|
|
6054
|
+
const accepted = options.experimental_openFixedTab?.(call) ?? false;
|
|
6055
|
+
if (accepted && target !== void 0 && panelId !== void 0) {
|
|
6056
|
+
fixedTabTargetSnapshot = {
|
|
6057
|
+
panelId,
|
|
6058
|
+
sequence: (fixedTabTargetSnapshot?.sequence ?? 0) + 1,
|
|
6059
|
+
tabId,
|
|
6060
|
+
target
|
|
6061
|
+
};
|
|
6062
|
+
for (const listener of fixedTabTargetListeners) listener();
|
|
6063
|
+
}
|
|
6064
|
+
return accepted;
|
|
6065
|
+
}
|
|
4568
6066
|
const appPanel = {
|
|
6067
|
+
experimental_openTab(tabOptions) {
|
|
6068
|
+
experimental_tabOpenCalls.push(tabOptions);
|
|
6069
|
+
if (options.experimental_openTab !== void 0)
|
|
6070
|
+
return options.experimental_openTab(tabOptions);
|
|
6071
|
+
if (tabOptions.tab.availability === "action") {
|
|
6072
|
+
try {
|
|
6073
|
+
const params = tabOptions.params === void 0 ? void 0 : strictJsonRoundTrip(tabOptions.params, "tab params");
|
|
6074
|
+
return navigate.openThreadPanel({
|
|
6075
|
+
actionId: tabOptions.tab.id,
|
|
6076
|
+
...tabOptions.title === void 0 ? {} : { title: tabOptions.title },
|
|
6077
|
+
...params === void 0 ? {} : { params }
|
|
6078
|
+
});
|
|
6079
|
+
} catch {
|
|
6080
|
+
return false;
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
try {
|
|
6084
|
+
const target = tabOptions.target === void 0 ? void 0 : strictJsonRoundTrip(tabOptions.target, "tab target");
|
|
6085
|
+
return captureFixedTabOpen(
|
|
6086
|
+
tabOptions.surface,
|
|
6087
|
+
tabOptions.tab.context.kind === "nav-panel" ? tabOptions.tab.context.panelId : void 0,
|
|
6088
|
+
tabOptions.tab.id,
|
|
6089
|
+
target
|
|
6090
|
+
);
|
|
6091
|
+
} catch {
|
|
6092
|
+
return false;
|
|
6093
|
+
}
|
|
6094
|
+
},
|
|
4569
6095
|
openFixedTab(panelOptions) {
|
|
4570
6096
|
let target;
|
|
4571
6097
|
if (panelOptions.target !== void 0) {
|
|
@@ -4586,24 +6112,26 @@ function renderSlot(registration, props, options = {}) {
|
|
|
4586
6112
|
return false;
|
|
4587
6113
|
}
|
|
4588
6114
|
}
|
|
4589
|
-
|
|
6115
|
+
if (panelOptions.tab.panelId === void 0) {
|
|
6116
|
+
if (target !== void 0) return false;
|
|
6117
|
+
return appPanel.experimental_openTab({
|
|
6118
|
+
surface: panelOptions.surface,
|
|
6119
|
+
tab: {
|
|
6120
|
+
id: panelOptions.tab.id,
|
|
6121
|
+
context: { kind: "thread" },
|
|
6122
|
+
availability: "fixed"
|
|
6123
|
+
}
|
|
6124
|
+
});
|
|
6125
|
+
}
|
|
6126
|
+
return appPanel.experimental_openTab({
|
|
4590
6127
|
surface: panelOptions.surface,
|
|
4591
|
-
|
|
4592
|
-
|
|
6128
|
+
tab: {
|
|
6129
|
+
id: panelOptions.tab.id,
|
|
6130
|
+
context: { kind: "nav-panel", panelId: panelOptions.tab.panelId },
|
|
6131
|
+
availability: "fixed"
|
|
6132
|
+
},
|
|
4593
6133
|
...target === void 0 ? {} : { target }
|
|
4594
|
-
};
|
|
4595
|
-
experimental_fixedTabOpenCalls.push(call);
|
|
4596
|
-
const accepted = options.experimental_openFixedTab?.(call) ?? false;
|
|
4597
|
-
if (accepted && target !== void 0) {
|
|
4598
|
-
fixedTabTargetSnapshot = {
|
|
4599
|
-
panelId: panelOptions.tab.panelId,
|
|
4600
|
-
sequence: (fixedTabTargetSnapshot?.sequence ?? 0) + 1,
|
|
4601
|
-
tabId: panelOptions.tab.id,
|
|
4602
|
-
target
|
|
4603
|
-
};
|
|
4604
|
-
for (const listener of fixedTabTargetListeners) listener();
|
|
4605
|
-
}
|
|
4606
|
-
return accepted;
|
|
6134
|
+
});
|
|
4607
6135
|
}
|
|
4608
6136
|
};
|
|
4609
6137
|
const sidebarActionCalls = [];
|
|
@@ -4652,9 +6180,6 @@ function renderSlot(registration, props, options = {}) {
|
|
|
4652
6180
|
}
|
|
4653
6181
|
};
|
|
4654
6182
|
const environmentArchiveCalls = [];
|
|
4655
|
-
const sidebarPullRequests = new Map(
|
|
4656
|
-
Object.entries(options.sidebarPullRequests ?? {})
|
|
4657
|
-
);
|
|
4658
6183
|
const sidebarDraftThreadIds = new Set(
|
|
4659
6184
|
options.sidebarDraftThreadIds ?? []
|
|
4660
6185
|
);
|
|
@@ -5044,6 +6569,7 @@ ${block}
|
|
|
5044
6569
|
navigateCalls,
|
|
5045
6570
|
appPanel,
|
|
5046
6571
|
experimental_fixedTabOpenCalls,
|
|
6572
|
+
experimental_tabOpenCalls,
|
|
5047
6573
|
fixedTabTarget,
|
|
5048
6574
|
composer,
|
|
5049
6575
|
composerLog,
|
|
@@ -5055,11 +6581,11 @@ ${block}
|
|
|
5055
6581
|
environmentArchiveCalls,
|
|
5056
6582
|
threadActions: options.threadActions ?? NO_THREAD_ACTIONS,
|
|
5057
6583
|
threadActionRegistrations: options.threadActionRegistrations ?? NO_THREAD_ACTION_REGISTRATIONS,
|
|
5058
|
-
sidebarPullRequests,
|
|
5059
6584
|
sidebarDraftThreadIds,
|
|
5060
6585
|
sidebarRowStatuses,
|
|
5061
6586
|
sidebarShortcuts,
|
|
5062
6587
|
sidebarSplitLayout: options.sidebarSplitLayout ?? null,
|
|
6588
|
+
composerRenderer: options.composerRenderer ?? null,
|
|
5063
6589
|
environmentProviders,
|
|
5064
6590
|
sdk,
|
|
5065
6591
|
sdkCalls,
|
|
@@ -5097,7 +6623,7 @@ ${block}
|
|
|
5097
6623
|
pageTitle = null;
|
|
5098
6624
|
};
|
|
5099
6625
|
}, [value]);
|
|
5100
|
-
return /* @__PURE__ */ jsx(
|
|
6626
|
+
return /* @__PURE__ */ jsx(Fragment2, { children });
|
|
5101
6627
|
}
|
|
5102
6628
|
const renderSlotTree = (ui) => /* @__PURE__ */ jsx(SlotEnvContext.Provider, { value: env, children: /* @__PURE__ */ jsx(SlotLifecycleGuard, { onUnmount: releaseComposerOwnership, children: /* @__PURE__ */ jsx(SlotPageTitle, { children: ui }) }) });
|
|
5103
6629
|
const Component = registration.component;
|
|
@@ -5116,7 +6642,15 @@ ${block}
|
|
|
5116
6642
|
});
|
|
5117
6643
|
};
|
|
5118
6644
|
const setRealtimeConnectionState = async (state) => {
|
|
5119
|
-
await act(async () =>
|
|
6645
|
+
await act(async () => {
|
|
6646
|
+
realtimeConnection.setState(state);
|
|
6647
|
+
if (state === "connected")
|
|
6648
|
+
await invalidateTags(
|
|
6649
|
+
queryClient,
|
|
6650
|
+
pluginTagScope(options.pluginId ?? "test-plugin"),
|
|
6651
|
+
null
|
|
6652
|
+
);
|
|
6653
|
+
});
|
|
5120
6654
|
};
|
|
5121
6655
|
const setComposerText2 = async (text) => {
|
|
5122
6656
|
await act(async () => commitComposerText(text));
|
|
@@ -5127,13 +6661,9 @@ ${block}
|
|
|
5127
6661
|
notifyComposerListeners();
|
|
5128
6662
|
});
|
|
5129
6663
|
};
|
|
5130
|
-
const experimental_invalidateRpc = async (tags) => {
|
|
6664
|
+
const experimental_invalidateRpc = async (tags, pluginId = options.pluginId ?? "test-plugin") => {
|
|
5131
6665
|
await act(async () => {
|
|
5132
|
-
await invalidateTags(
|
|
5133
|
-
queryClient,
|
|
5134
|
-
pluginTagScope(rpcQueryHost.pluginId),
|
|
5135
|
-
tags
|
|
5136
|
-
);
|
|
6666
|
+
await invalidateTags(queryClient, pluginTagScope(pluginId), tags);
|
|
5137
6667
|
});
|
|
5138
6668
|
};
|
|
5139
6669
|
const unmountSlot = () => {
|
|
@@ -5152,6 +6682,7 @@ ${block}
|
|
|
5152
6682
|
setComposerScope,
|
|
5153
6683
|
navigateCalls,
|
|
5154
6684
|
experimental_fixedTabOpenCalls,
|
|
6685
|
+
experimental_tabOpenCalls,
|
|
5155
6686
|
sidebarActionCalls,
|
|
5156
6687
|
sidebarNavigationCalls,
|
|
5157
6688
|
experimental_environmentArchiveCalls: environmentArchiveCalls,
|
|
@@ -5172,6 +6703,7 @@ ${block}
|
|
|
5172
6703
|
rpcCalls,
|
|
5173
6704
|
navigateCalls,
|
|
5174
6705
|
experimental_fixedTabOpenCalls,
|
|
6706
|
+
experimental_tabOpenCalls,
|
|
5175
6707
|
sidebarActionCalls,
|
|
5176
6708
|
sidebarNavigationCalls,
|
|
5177
6709
|
experimental_environmentArchiveCalls: environmentArchiveCalls,
|