@get-bb/plugin-sdk 0.6.150 → 0.6.164
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 +4 -1
- package/bundled-types/bb-plugin-sdk-app.d.ts +707 -86
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +3 -0
- package/bundled-types/bb-plugin-sdk-host.d.ts +4 -1
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +3 -0
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +6 -3
- package/bundled-types/bb-plugin-sdk-internal-thread-event-gate.d.ts +1001 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp-next.d.ts +56 -6
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp.d.ts +56 -6
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +45 -8
- package/bundled-types/bb-plugin-sdk-testing.d.ts +104 -20
- package/bundled-types/bb-plugin-sdk.d.ts +869 -300
- package/dist/app.js +8 -0
- package/dist/host.js +27 -3
- package/dist/index.js +19 -1
- package/dist/internal/host-policy.js +24 -2
- package/dist/internal/plugin-app-collector.js +20 -0
- package/dist/internal/rpc-query-host.js +1 -0
- package/dist/internal/thread-event-gate.js +95 -0
- package/dist/process.js +7 -1
- package/dist/provider-bridge-acp-next.js +503 -144
- package/dist/provider-bridge-acp.js +503 -144
- package/dist/provider-bridge-testing.js +21 -7
- package/dist/provider-bridge-worker-entry.mjs +9 -3
- package/dist/provider-bridge.js +124 -37
- package/dist/replay-provider-child.mjs +158 -31
- package/dist/testing/app.js +627 -347
- package/dist/testing/index.js +432 -77
- package/package.json +9 -1
package/dist/testing/app.js
CHANGED
|
@@ -1535,11 +1535,251 @@ var projectExecutionDefaultsSchema = z2.object({
|
|
|
1535
1535
|
import { z as z3 } from "zod";
|
|
1536
1536
|
var pluginIdSchema = z3.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
|
|
1537
1537
|
|
|
1538
|
+
// ../domain/src/app-keybindings.ts
|
|
1539
|
+
import { z as z4 } from "zod";
|
|
1540
|
+
var THREAD_JUMP_APP_COMMAND_IDS = [
|
|
1541
|
+
"thread.jump.1",
|
|
1542
|
+
"thread.jump.2",
|
|
1543
|
+
"thread.jump.3",
|
|
1544
|
+
"thread.jump.4",
|
|
1545
|
+
"thread.jump.5",
|
|
1546
|
+
"thread.jump.6",
|
|
1547
|
+
"thread.jump.7",
|
|
1548
|
+
"thread.jump.8",
|
|
1549
|
+
"thread.jump.9"
|
|
1550
|
+
];
|
|
1551
|
+
var QUESTION_SELECT_APP_COMMAND_IDS = [
|
|
1552
|
+
"question.select.1",
|
|
1553
|
+
"question.select.2",
|
|
1554
|
+
"question.select.3",
|
|
1555
|
+
"question.select.4",
|
|
1556
|
+
"question.select.5",
|
|
1557
|
+
"question.select.6",
|
|
1558
|
+
"question.select.7",
|
|
1559
|
+
"question.select.8",
|
|
1560
|
+
"question.select.9"
|
|
1561
|
+
];
|
|
1562
|
+
var QUESTION_ACTION_APP_COMMAND_IDS = [
|
|
1563
|
+
"question.submit",
|
|
1564
|
+
"question.previous",
|
|
1565
|
+
"question.next",
|
|
1566
|
+
"question.cancel"
|
|
1567
|
+
];
|
|
1568
|
+
var PANE_DIRECTION_APP_COMMAND_IDS = [
|
|
1569
|
+
"pane.focus.left",
|
|
1570
|
+
"pane.focus.right",
|
|
1571
|
+
"pane.focus.up",
|
|
1572
|
+
"pane.focus.down"
|
|
1573
|
+
];
|
|
1574
|
+
var PANE_FOCUS_APP_COMMAND_IDS = [
|
|
1575
|
+
"pane.focus.1",
|
|
1576
|
+
"pane.focus.2",
|
|
1577
|
+
"pane.focus.3",
|
|
1578
|
+
"pane.focus.4",
|
|
1579
|
+
"pane.focus.5",
|
|
1580
|
+
"pane.focus.6",
|
|
1581
|
+
"pane.focus.7",
|
|
1582
|
+
"pane.focus.8"
|
|
1583
|
+
];
|
|
1584
|
+
var APP_COMMAND_IDS = [
|
|
1585
|
+
"palette.open",
|
|
1586
|
+
"thread.new",
|
|
1587
|
+
"thread.search",
|
|
1588
|
+
"thread.rename",
|
|
1589
|
+
"thread.archive",
|
|
1590
|
+
"thread.markRead",
|
|
1591
|
+
"thread.pin",
|
|
1592
|
+
"thread.previous",
|
|
1593
|
+
"thread.next",
|
|
1594
|
+
"history.back",
|
|
1595
|
+
"history.forward",
|
|
1596
|
+
...THREAD_JUMP_APP_COMMAND_IDS,
|
|
1597
|
+
...PANE_DIRECTION_APP_COMMAND_IDS,
|
|
1598
|
+
"pane.focus.previous",
|
|
1599
|
+
"pane.focus.next",
|
|
1600
|
+
...PANE_FOCUS_APP_COMMAND_IDS,
|
|
1601
|
+
"pane.maximize.toggle",
|
|
1602
|
+
"pane.close",
|
|
1603
|
+
"window.new",
|
|
1604
|
+
"window.find",
|
|
1605
|
+
"window.reload",
|
|
1606
|
+
"app.back",
|
|
1607
|
+
"settings.open",
|
|
1608
|
+
"settings.openServers",
|
|
1609
|
+
"sidebar.toggle",
|
|
1610
|
+
"panel.previousTab",
|
|
1611
|
+
"panel.nextTab",
|
|
1612
|
+
"panel.previousNewTabItem",
|
|
1613
|
+
"panel.nextNewTabItem",
|
|
1614
|
+
"panel.newTab",
|
|
1615
|
+
"panel.reopenClosedTab",
|
|
1616
|
+
"panel.close",
|
|
1617
|
+
"panel.toggle",
|
|
1618
|
+
"panel.fullScreen.toggle",
|
|
1619
|
+
"file.quickOpen",
|
|
1620
|
+
"terminal.open",
|
|
1621
|
+
"terminal.find",
|
|
1622
|
+
"composer.focus",
|
|
1623
|
+
"modelPicker.toggle",
|
|
1624
|
+
"modelPicker.cycleModel",
|
|
1625
|
+
"modelPicker.cycleModelBackward",
|
|
1626
|
+
"modelPicker.cycleProvider",
|
|
1627
|
+
"modelPicker.cycleProviderBackward",
|
|
1628
|
+
"modelPicker.cycleReasoning",
|
|
1629
|
+
"modelPicker.cycleReasoningBackward",
|
|
1630
|
+
"browser.focusLocation",
|
|
1631
|
+
"browser.reload",
|
|
1632
|
+
"browser.find",
|
|
1633
|
+
"workspace.openPreferred",
|
|
1634
|
+
"logs.openServerDaemon",
|
|
1635
|
+
"dataDirectory.open",
|
|
1636
|
+
"notifications.open",
|
|
1637
|
+
"plugins.enterSafeMode",
|
|
1638
|
+
"plugins.exitSafeMode",
|
|
1639
|
+
"plugins.pruneCache",
|
|
1640
|
+
...QUESTION_SELECT_APP_COMMAND_IDS,
|
|
1641
|
+
...QUESTION_ACTION_APP_COMMAND_IDS
|
|
1642
|
+
];
|
|
1643
|
+
var appCommandIdSchema = z4.enum(APP_COMMAND_IDS);
|
|
1644
|
+
var pluginCommandIdSchema = z4.templateLiteral(["plugin:", z4.string(), "/", z4.string()]).refine(
|
|
1645
|
+
(id) => /^plugin:[a-z0-9][a-z0-9-]*\/[a-zA-Z0-9_-]+$/u.test(id) && id.length <= 256,
|
|
1646
|
+
"Invalid plugin command ID"
|
|
1647
|
+
);
|
|
1648
|
+
var keyboardCommandIdSchema = z4.union([
|
|
1649
|
+
appCommandIdSchema,
|
|
1650
|
+
pluginCommandIdSchema
|
|
1651
|
+
]);
|
|
1652
|
+
var APP_COMMAND_CONTEXT_KEYS = [
|
|
1653
|
+
"mainSurface",
|
|
1654
|
+
"modalOpen",
|
|
1655
|
+
"editableFocus",
|
|
1656
|
+
"terminalFocus",
|
|
1657
|
+
"browserFocus",
|
|
1658
|
+
"modelPickerOpen",
|
|
1659
|
+
"questionOpen",
|
|
1660
|
+
"questionFocus",
|
|
1661
|
+
"promptAvailable",
|
|
1662
|
+
"splitActive",
|
|
1663
|
+
"webSurface",
|
|
1664
|
+
"macPlatform",
|
|
1665
|
+
"windowsPlatform",
|
|
1666
|
+
"linuxPlatform"
|
|
1667
|
+
];
|
|
1668
|
+
var appCommandContextKeySchema = z4.enum(APP_COMMAND_CONTEXT_KEYS);
|
|
1669
|
+
var appShortcutSchema = z4.object({
|
|
1670
|
+
key: z4.string().min(1).max(32),
|
|
1671
|
+
mod: z4.boolean(),
|
|
1672
|
+
meta: z4.boolean(),
|
|
1673
|
+
control: z4.boolean(),
|
|
1674
|
+
alt: z4.boolean(),
|
|
1675
|
+
shift: z4.boolean()
|
|
1676
|
+
}).strict();
|
|
1677
|
+
var SHIFTED_KEY_BASES = {
|
|
1678
|
+
"~": "`",
|
|
1679
|
+
"!": "1",
|
|
1680
|
+
"@": "2",
|
|
1681
|
+
"#": "3",
|
|
1682
|
+
$: "4",
|
|
1683
|
+
"%": "5",
|
|
1684
|
+
"^": "6",
|
|
1685
|
+
"&": "7",
|
|
1686
|
+
"*": "8",
|
|
1687
|
+
"(": "9",
|
|
1688
|
+
")": "0",
|
|
1689
|
+
_: "-",
|
|
1690
|
+
"+": "=",
|
|
1691
|
+
"{": "[",
|
|
1692
|
+
"}": "]",
|
|
1693
|
+
"|": "\\",
|
|
1694
|
+
":": ";",
|
|
1695
|
+
'"': "'",
|
|
1696
|
+
"<": ",",
|
|
1697
|
+
">": ".",
|
|
1698
|
+
"?": "/"
|
|
1699
|
+
};
|
|
1700
|
+
var PUNCTUATION_KEYS_BY_CODE = {
|
|
1701
|
+
Backquote: "`",
|
|
1702
|
+
Minus: "-",
|
|
1703
|
+
Equal: "=",
|
|
1704
|
+
BracketLeft: "[",
|
|
1705
|
+
BracketRight: "]",
|
|
1706
|
+
Backslash: "\\",
|
|
1707
|
+
Semicolon: ";",
|
|
1708
|
+
Quote: "'",
|
|
1709
|
+
Comma: ",",
|
|
1710
|
+
Period: ".",
|
|
1711
|
+
Slash: "/"
|
|
1712
|
+
};
|
|
1713
|
+
function baseKeyFromCode(code) {
|
|
1714
|
+
if (/^Key[A-Z]$/u.test(code)) return code.slice(3).toLowerCase();
|
|
1715
|
+
if (/^Digit[0-9]$/u.test(code)) return code.slice(5);
|
|
1716
|
+
return PUNCTUATION_KEYS_BY_CODE[code] ?? null;
|
|
1717
|
+
}
|
|
1718
|
+
function isAsciiAlphanumeric(value) {
|
|
1719
|
+
return /^[a-z0-9]$/iu.test(value);
|
|
1720
|
+
}
|
|
1721
|
+
function isNonLatinCharacter(value) {
|
|
1722
|
+
return /^(?![\p{Script=Latin}0-9])[\p{L}\p{N}]$/u.test(value);
|
|
1723
|
+
}
|
|
1724
|
+
function layoutAppShortcutKey(input) {
|
|
1725
|
+
if (input.key === " " || input.key === "Spacebar") {
|
|
1726
|
+
return "Space";
|
|
1727
|
+
}
|
|
1728
|
+
return input.shiftKey ? SHIFTED_KEY_BASES[input.key] ?? input.key : input.key;
|
|
1729
|
+
}
|
|
1730
|
+
function normalizeAppShortcutInputKey(input) {
|
|
1731
|
+
const usePhysicalKey = input.altKey ? !isAsciiAlphanumeric(input.key) : isNonLatinCharacter(input.key);
|
|
1732
|
+
if (usePhysicalKey) {
|
|
1733
|
+
const fromCode = baseKeyFromCode(input.code);
|
|
1734
|
+
if (fromCode !== null) return fromCode;
|
|
1735
|
+
}
|
|
1736
|
+
return layoutAppShortcutKey(input);
|
|
1737
|
+
}
|
|
1738
|
+
function matchesAppShortcutKey(input, key) {
|
|
1739
|
+
const expected = key.toLowerCase();
|
|
1740
|
+
return normalizeAppShortcutInputKey(input).toLowerCase() === expected || !input.altKey && layoutAppShortcutKey(input).toLowerCase() === expected;
|
|
1741
|
+
}
|
|
1742
|
+
var keyboardPlatformSchema = z4.enum(["mac", "windows", "linux"]);
|
|
1743
|
+
var appCommandWhenSchema = z4.object({
|
|
1744
|
+
all: z4.array(appCommandContextKeySchema),
|
|
1745
|
+
none: z4.array(appCommandContextKeySchema)
|
|
1746
|
+
}).strict();
|
|
1747
|
+
var appKeybindingSchema = z4.object({
|
|
1748
|
+
command: keyboardCommandIdSchema,
|
|
1749
|
+
desktopOnly: z4.boolean(),
|
|
1750
|
+
shortcut: appShortcutSchema,
|
|
1751
|
+
when: appCommandWhenSchema
|
|
1752
|
+
}).strict();
|
|
1753
|
+
var appDefaultKeybindingSchema = appKeybindingSchema.extend({
|
|
1754
|
+
shortcut: appShortcutSchema.nullable()
|
|
1755
|
+
});
|
|
1756
|
+
var appKeybindingsSchema = z4.array(appKeybindingSchema).max(1024);
|
|
1757
|
+
var appDefaultKeybindingsSchema = z4.array(appDefaultKeybindingSchema).max(256);
|
|
1758
|
+
var appKeybindingOverrideSchema = z4.object({
|
|
1759
|
+
command: keyboardCommandIdSchema,
|
|
1760
|
+
shortcut: appShortcutSchema.nullable(),
|
|
1761
|
+
platform: keyboardPlatformSchema.optional()
|
|
1762
|
+
}).strict();
|
|
1763
|
+
var appKeybindingOverridesSchema = z4.array(appKeybindingOverrideSchema).max(1024).superRefine((overrides, context) => {
|
|
1764
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1765
|
+
for (const [index, override] of overrides.entries()) {
|
|
1766
|
+
const key = `${override.command}:${override.platform ?? "all"}`;
|
|
1767
|
+
if (seen.has(key)) {
|
|
1768
|
+
context.addIssue({
|
|
1769
|
+
code: "custom",
|
|
1770
|
+
message: `Duplicate override for ${override.command}`,
|
|
1771
|
+
path: [index, "command"]
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
seen.add(key);
|
|
1775
|
+
}
|
|
1776
|
+
});
|
|
1777
|
+
|
|
1538
1778
|
// ../domain/src/change-kinds.ts
|
|
1539
|
-
import { z as
|
|
1779
|
+
import { z as z18 } from "zod";
|
|
1540
1780
|
|
|
1541
1781
|
// ../domain/src/thread-event-types.ts
|
|
1542
|
-
import { z as
|
|
1782
|
+
import { z as z5 } from "zod";
|
|
1543
1783
|
var systemEventTypeValues = [
|
|
1544
1784
|
"client/thread/start",
|
|
1545
1785
|
"client/turn/requested",
|
|
@@ -1598,30 +1838,30 @@ var threadEventTypeValues = [
|
|
|
1598
1838
|
...systemEventTypeValues
|
|
1599
1839
|
];
|
|
1600
1840
|
var threadEventTypeSet = new Set(threadEventTypeValues);
|
|
1601
|
-
var threadEventTypeSchema =
|
|
1841
|
+
var threadEventTypeSchema = z5.string().refine(
|
|
1602
1842
|
(value) => threadEventTypeSet.has(value),
|
|
1603
1843
|
"Invalid thread event type"
|
|
1604
1844
|
);
|
|
1605
1845
|
|
|
1606
1846
|
// ../domain/src/thread.ts
|
|
1607
|
-
import { z as
|
|
1847
|
+
import { z as z17 } from "zod";
|
|
1608
1848
|
|
|
1609
1849
|
// ../domain/src/thread-create-origin.ts
|
|
1610
|
-
import { z as
|
|
1850
|
+
import { z as z6 } from "zod";
|
|
1611
1851
|
var threadCreateOriginValues = ["app", "cli", "sdk", "plugin"];
|
|
1612
|
-
var threadCreateOriginSchema =
|
|
1852
|
+
var threadCreateOriginSchema = z6.enum(threadCreateOriginValues);
|
|
1613
1853
|
|
|
1614
1854
|
// ../domain/src/environment.ts
|
|
1615
|
-
import { z as
|
|
1616
|
-
var environmentMachineSelectionSchema =
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
type:
|
|
1620
|
-
machineProviderId:
|
|
1855
|
+
import { z as z7 } from "zod";
|
|
1856
|
+
var environmentMachineSelectionSchema = z7.discriminatedUnion("type", [
|
|
1857
|
+
z7.object({ type: z7.literal("existing"), hostId: z7.string().min(1) }),
|
|
1858
|
+
z7.object({
|
|
1859
|
+
type: z7.literal("new"),
|
|
1860
|
+
machineProviderId: z7.string().min(1),
|
|
1621
1861
|
inputs: jsonValueSchema.nullable()
|
|
1622
1862
|
})
|
|
1623
1863
|
]);
|
|
1624
|
-
var environmentProviderSelectionSchema =
|
|
1864
|
+
var environmentProviderSelectionSchema = z7.object({
|
|
1625
1865
|
machine: environmentMachineSelectionSchema,
|
|
1626
1866
|
inputs: jsonValueSchema.nullable()
|
|
1627
1867
|
});
|
|
@@ -1632,14 +1872,14 @@ var environmentStatusValues = [
|
|
|
1632
1872
|
"error",
|
|
1633
1873
|
"destroyed"
|
|
1634
1874
|
];
|
|
1635
|
-
var environmentStatusSchema =
|
|
1875
|
+
var environmentStatusSchema = z7.enum(environmentStatusValues);
|
|
1636
1876
|
var environmentHostLifecycleValues = [
|
|
1637
1877
|
"active",
|
|
1638
1878
|
"removing",
|
|
1639
1879
|
"cleanup-failed",
|
|
1640
1880
|
"removed"
|
|
1641
1881
|
];
|
|
1642
|
-
var environmentHostLifecycleSchema =
|
|
1882
|
+
var environmentHostLifecycleSchema = z7.enum(
|
|
1643
1883
|
environmentHostLifecycleValues
|
|
1644
1884
|
);
|
|
1645
1885
|
var WORKSPACE_PROVISION_TYPES = [
|
|
@@ -1647,64 +1887,65 @@ var WORKSPACE_PROVISION_TYPES = [
|
|
|
1647
1887
|
"managed-worktree",
|
|
1648
1888
|
"personal"
|
|
1649
1889
|
];
|
|
1650
|
-
var workspaceProvisionTypeSchema =
|
|
1890
|
+
var workspaceProvisionTypeSchema = z7.enum(WORKSPACE_PROVISION_TYPES);
|
|
1651
1891
|
var environmentWorkspaceDisplayKindValues = [
|
|
1652
1892
|
"managed-worktree",
|
|
1653
1893
|
"unmanaged-worktree",
|
|
1654
1894
|
"other"
|
|
1655
1895
|
];
|
|
1656
|
-
var environmentWorkspaceDisplayKindSchema =
|
|
1896
|
+
var environmentWorkspaceDisplayKindSchema = z7.enum(
|
|
1657
1897
|
environmentWorkspaceDisplayKindValues
|
|
1658
1898
|
);
|
|
1659
|
-
var discoveredWorkspacePropertiesSchema =
|
|
1660
|
-
path:
|
|
1661
|
-
isGitRepo:
|
|
1662
|
-
isWorktree:
|
|
1663
|
-
branchName:
|
|
1664
|
-
defaultBranch:
|
|
1899
|
+
var discoveredWorkspacePropertiesSchema = z7.object({
|
|
1900
|
+
path: z7.string().min(1),
|
|
1901
|
+
isGitRepo: z7.boolean(),
|
|
1902
|
+
isWorktree: z7.boolean(),
|
|
1903
|
+
branchName: z7.string().nullable(),
|
|
1904
|
+
defaultBranch: z7.string().nullable()
|
|
1665
1905
|
});
|
|
1666
|
-
var environmentLifecycleSchema =
|
|
1667
|
-
phase:
|
|
1668
|
-
retireAt:
|
|
1669
|
-
teardown:
|
|
1670
|
-
status:
|
|
1671
|
-
attempt:
|
|
1672
|
-
|
|
1906
|
+
var environmentLifecycleSchema = z7.object({
|
|
1907
|
+
phase: z7.enum(["active", "retiring", "teardown", "destroyed"]),
|
|
1908
|
+
retireAt: z7.number().nullable(),
|
|
1909
|
+
teardown: z7.object({
|
|
1910
|
+
status: z7.enum(["running", "failed", "removed"]),
|
|
1911
|
+
attempt: z7.number().int().nonnegative(),
|
|
1912
|
+
needsRecovery: z7.boolean(),
|
|
1913
|
+
message: z7.string().optional()
|
|
1673
1914
|
}).nullable()
|
|
1674
1915
|
});
|
|
1675
|
-
var environmentSchema =
|
|
1676
|
-
id:
|
|
1677
|
-
name:
|
|
1678
|
-
projectId:
|
|
1679
|
-
hostId:
|
|
1680
|
-
path:
|
|
1681
|
-
isGitRepo:
|
|
1682
|
-
isWorktree:
|
|
1683
|
-
branchName:
|
|
1684
|
-
baseBranch:
|
|
1685
|
-
defaultBranch:
|
|
1686
|
-
mergeBaseBranch:
|
|
1916
|
+
var environmentSchema = z7.object({
|
|
1917
|
+
id: z7.string(),
|
|
1918
|
+
name: z7.string().nullable(),
|
|
1919
|
+
projectId: z7.string(),
|
|
1920
|
+
hostId: z7.string(),
|
|
1921
|
+
path: z7.string().nullable(),
|
|
1922
|
+
isGitRepo: z7.boolean(),
|
|
1923
|
+
isWorktree: z7.boolean(),
|
|
1924
|
+
branchName: z7.string().nullable(),
|
|
1925
|
+
baseBranch: z7.string().nullable(),
|
|
1926
|
+
defaultBranch: z7.string().nullable(),
|
|
1927
|
+
mergeBaseBranch: z7.string().nullable(),
|
|
1687
1928
|
status: environmentStatusSchema,
|
|
1688
|
-
environmentProviderId:
|
|
1929
|
+
environmentProviderId: z7.string().nullable(),
|
|
1689
1930
|
lifecycle: environmentLifecycleSchema,
|
|
1690
1931
|
hostLifecycle: environmentHostLifecycleSchema,
|
|
1691
1932
|
environmentProviderSelection: environmentProviderSelectionSchema.nullable(),
|
|
1692
|
-
environmentProviderInstanceKey:
|
|
1693
|
-
managed:
|
|
1933
|
+
environmentProviderInstanceKey: z7.string().nullable(),
|
|
1934
|
+
managed: z7.boolean(),
|
|
1694
1935
|
workspaceProvisionType: workspaceProvisionTypeSchema.nullable(),
|
|
1695
|
-
createdAt:
|
|
1696
|
-
updatedAt:
|
|
1936
|
+
createdAt: z7.number(),
|
|
1937
|
+
updatedAt: z7.number()
|
|
1697
1938
|
});
|
|
1698
1939
|
|
|
1699
1940
|
// ../domain/src/queued-message.ts
|
|
1700
|
-
import { z as
|
|
1941
|
+
import { z as z10 } from "zod";
|
|
1701
1942
|
|
|
1702
1943
|
// ../domain/src/protocol-ids.ts
|
|
1703
|
-
import { z as
|
|
1704
|
-
var clientTurnRequestIdSchema =
|
|
1944
|
+
import { z as z8 } from "zod";
|
|
1945
|
+
var clientTurnRequestIdSchema = z8.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
|
|
1705
1946
|
|
|
1706
1947
|
// ../domain/src/system-message.ts
|
|
1707
|
-
import { z as
|
|
1948
|
+
import { z as z9 } from "zod";
|
|
1708
1949
|
var systemMessageKindValues = [
|
|
1709
1950
|
"ownership-assigned",
|
|
1710
1951
|
"ownership-removed",
|
|
@@ -1718,41 +1959,41 @@ var systemMessageKindValues = [
|
|
|
1718
1959
|
"environment-directory-updated",
|
|
1719
1960
|
"unlabeled"
|
|
1720
1961
|
];
|
|
1721
|
-
var systemMessageKindSchema =
|
|
1722
|
-
var systemThreadInterruptedReasonSchema =
|
|
1962
|
+
var systemMessageKindSchema = z9.enum(systemMessageKindValues);
|
|
1963
|
+
var systemThreadInterruptedReasonSchema = z9.enum([
|
|
1723
1964
|
"manual-stop",
|
|
1724
1965
|
"host-daemon-restarted",
|
|
1725
1966
|
"host-removed",
|
|
1726
1967
|
"provider-turn-idle"
|
|
1727
1968
|
]);
|
|
1728
|
-
var childThreadOutcomeSchema =
|
|
1729
|
-
threadId:
|
|
1730
|
-
status:
|
|
1731
|
-
interruption:
|
|
1969
|
+
var childThreadOutcomeSchema = z9.object({
|
|
1970
|
+
threadId: z9.string(),
|
|
1971
|
+
status: z9.enum(["completed", "failed", "interrupted"]),
|
|
1972
|
+
interruption: z9.object({
|
|
1732
1973
|
reason: systemThreadInterruptedReasonSchema,
|
|
1733
|
-
cause:
|
|
1974
|
+
cause: z9.literal("host-connection-lost").optional()
|
|
1734
1975
|
}).optional()
|
|
1735
1976
|
});
|
|
1736
|
-
var systemMessageSubjectSchema =
|
|
1737
|
-
|
|
1738
|
-
kind:
|
|
1739
|
-
threadId:
|
|
1740
|
-
threadName:
|
|
1741
|
-
outcomes:
|
|
1977
|
+
var systemMessageSubjectSchema = z9.discriminatedUnion("kind", [
|
|
1978
|
+
z9.object({
|
|
1979
|
+
kind: z9.literal("thread"),
|
|
1980
|
+
threadId: z9.string(),
|
|
1981
|
+
threadName: z9.string(),
|
|
1982
|
+
outcomes: z9.array(childThreadOutcomeSchema).optional()
|
|
1742
1983
|
}),
|
|
1743
|
-
|
|
1744
|
-
kind:
|
|
1745
|
-
count:
|
|
1746
|
-
outcomes:
|
|
1984
|
+
z9.object({
|
|
1985
|
+
kind: z9.literal("thread-batch"),
|
|
1986
|
+
count: z9.number(),
|
|
1987
|
+
outcomes: z9.array(childThreadOutcomeSchema).optional()
|
|
1747
1988
|
}),
|
|
1748
|
-
|
|
1749
|
-
kind:
|
|
1750
|
-
toolName:
|
|
1751
|
-
suppress:
|
|
1989
|
+
z9.object({
|
|
1990
|
+
kind: z9.literal("tool-call"),
|
|
1991
|
+
toolName: z9.string(),
|
|
1992
|
+
suppress: z9.boolean()
|
|
1752
1993
|
}),
|
|
1753
|
-
|
|
1754
|
-
kind:
|
|
1755
|
-
path:
|
|
1994
|
+
z9.object({
|
|
1995
|
+
kind: z9.literal("directory"),
|
|
1996
|
+
path: z9.string()
|
|
1756
1997
|
})
|
|
1757
1998
|
]);
|
|
1758
1999
|
|
|
@@ -1769,46 +2010,46 @@ var queuedMessageWaitingOnKindValues = [
|
|
|
1769
2010
|
"plugin",
|
|
1770
2011
|
"superseded"
|
|
1771
2012
|
];
|
|
1772
|
-
var queuedMessageWaitingOnKindSchema =
|
|
2013
|
+
var queuedMessageWaitingOnKindSchema = z10.enum(
|
|
1773
2014
|
queuedMessageWaitingOnKindValues
|
|
1774
2015
|
);
|
|
1775
|
-
var queuedMessageWaitHostNameSchema =
|
|
2016
|
+
var queuedMessageWaitHostNameSchema = z10.string().min(1).max(200);
|
|
1776
2017
|
var QUEUED_MESSAGE_WAIT_REASON_MAX_LENGTH = 200;
|
|
1777
|
-
var queuedMessageWaitReasonSchema =
|
|
1778
|
-
var queuedMessageWaitingOnSchema =
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
kind:
|
|
2018
|
+
var queuedMessageWaitReasonSchema = z10.string().min(1).max(QUEUED_MESSAGE_WAIT_REASON_MAX_LENGTH);
|
|
2019
|
+
var queuedMessageWaitingOnSchema = z10.discriminatedUnion("kind", [
|
|
2020
|
+
z10.object({ kind: z10.literal("time") }),
|
|
2021
|
+
z10.object({ kind: z10.literal("thread-busy") }),
|
|
2022
|
+
z10.object({ kind: z10.literal("stopping") }),
|
|
2023
|
+
z10.object({ kind: z10.literal("turn-starting") }),
|
|
2024
|
+
z10.object({ kind: z10.literal("provisioning") }),
|
|
2025
|
+
z10.object({
|
|
2026
|
+
kind: z10.literal("host-offline"),
|
|
1786
2027
|
hostName: queuedMessageWaitHostNameSchema
|
|
1787
2028
|
}),
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
kind:
|
|
2029
|
+
z10.object({ kind: z10.literal("interaction") }),
|
|
2030
|
+
z10.object({ kind: z10.literal("app-update") }),
|
|
2031
|
+
z10.object({
|
|
2032
|
+
kind: z10.literal("plugin"),
|
|
1792
2033
|
pluginId: pluginIdSchema,
|
|
1793
2034
|
reason: queuedMessageWaitReasonSchema
|
|
1794
2035
|
}),
|
|
1795
|
-
|
|
2036
|
+
z10.object({ kind: z10.literal("superseded") })
|
|
1796
2037
|
]);
|
|
1797
2038
|
var QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH = 200;
|
|
1798
|
-
var queuedMessageFailureReasonSchema =
|
|
2039
|
+
var queuedMessageFailureReasonSchema = z10.string().min(1).max(QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH);
|
|
1799
2040
|
var QUEUED_MESSAGE_PLUGIN_WAIT_HOLDER_PREFIX = "plugin:";
|
|
1800
|
-
var queuedMessageWaitHolderSchema =
|
|
2041
|
+
var queuedMessageWaitHolderSchema = z10.templateLiteral([
|
|
1801
2042
|
QUEUED_MESSAGE_PLUGIN_WAIT_HOLDER_PREFIX,
|
|
1802
2043
|
pluginIdSchema
|
|
1803
2044
|
]);
|
|
1804
2045
|
var queuedMessagePayloadKindValues = ["inline", "retry"];
|
|
1805
|
-
var queuedMessagePayloadKindSchema =
|
|
2046
|
+
var queuedMessagePayloadKindSchema = z10.enum(
|
|
1806
2047
|
queuedMessagePayloadKindValues
|
|
1807
2048
|
);
|
|
1808
|
-
var queuedMessagePayloadSchema =
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
kind:
|
|
2049
|
+
var queuedMessagePayloadSchema = z10.discriminatedUnion("kind", [
|
|
2050
|
+
z10.object({ kind: z10.literal("inline") }),
|
|
2051
|
+
z10.object({
|
|
2052
|
+
kind: z10.literal("retry"),
|
|
1812
2053
|
/**
|
|
1813
2054
|
* The ORIGINAL request, not the attempt that just failed. Retrying a retry
|
|
1814
2055
|
* re-submits the same original blocks, so this id is carried forward
|
|
@@ -1816,7 +2057,7 @@ var queuedMessagePayloadSchema = z9.discriminatedUnion("kind", [
|
|
|
1816
2057
|
*/
|
|
1817
2058
|
retryOfTurnRequestId: clientTurnRequestIdSchema,
|
|
1818
2059
|
/** Which attempt this row will dispatch: 2 is the first retry. */
|
|
1819
|
-
attempt:
|
|
2060
|
+
attempt: z10.number().int().min(2),
|
|
1820
2061
|
/**
|
|
1821
2062
|
* Why this turn is being retried, in the retrier's words ("Rate limited"),
|
|
1822
2063
|
* as the row's card and `bb thread queue list` render it.
|
|
@@ -1829,13 +2070,13 @@ var queuedMessagePayloadSchema = z9.discriminatedUnion("kind", [
|
|
|
1829
2070
|
reason: queuedMessageWaitReasonSchema
|
|
1830
2071
|
})
|
|
1831
2072
|
]);
|
|
1832
|
-
var queuedMessageSystemNoticeSchema =
|
|
2073
|
+
var queuedMessageSystemNoticeSchema = z10.object({
|
|
1833
2074
|
kind: systemMessageKindSchema,
|
|
1834
2075
|
subject: systemMessageSubjectSchema.nullable()
|
|
1835
2076
|
});
|
|
1836
2077
|
|
|
1837
2078
|
// ../domain/src/queued-message-lifecycle.ts
|
|
1838
|
-
import { z as
|
|
2079
|
+
import { z as z11 } from "zod";
|
|
1839
2080
|
var queuedMessageStateValues = [
|
|
1840
2081
|
"queued",
|
|
1841
2082
|
"scheduled",
|
|
@@ -1844,14 +2085,14 @@ var queuedMessageStateValues = [
|
|
|
1844
2085
|
"failed_exhausted",
|
|
1845
2086
|
"claimed"
|
|
1846
2087
|
];
|
|
1847
|
-
var queuedMessageStateSchema =
|
|
2088
|
+
var queuedMessageStateSchema = z11.enum(queuedMessageStateValues);
|
|
1848
2089
|
var queuedMessageDeliveryModeValues = ["steer", "queue"];
|
|
1849
|
-
var queuedMessageDeliveryModeSchema =
|
|
2090
|
+
var queuedMessageDeliveryModeSchema = z11.enum(
|
|
1850
2091
|
queuedMessageDeliveryModeValues
|
|
1851
2092
|
);
|
|
1852
2093
|
|
|
1853
2094
|
// ../domain/src/thread-status.ts
|
|
1854
|
-
import { z as
|
|
2095
|
+
import { z as z12 } from "zod";
|
|
1855
2096
|
var threadStatusValues = [
|
|
1856
2097
|
"pending",
|
|
1857
2098
|
"idle",
|
|
@@ -1860,74 +2101,74 @@ var threadStatusValues = [
|
|
|
1860
2101
|
"stopping",
|
|
1861
2102
|
"error"
|
|
1862
2103
|
];
|
|
1863
|
-
var threadStatusSchema =
|
|
2104
|
+
var threadStatusSchema = z12.enum(threadStatusValues);
|
|
1864
2105
|
|
|
1865
2106
|
// ../domain/src/thread-origin-kind.ts
|
|
1866
|
-
import { z as
|
|
2107
|
+
import { z as z13 } from "zod";
|
|
1867
2108
|
var threadOriginKindValues = ["fork"];
|
|
1868
|
-
var threadOriginKindSchema =
|
|
2109
|
+
var threadOriginKindSchema = z13.enum(threadOriginKindValues);
|
|
1869
2110
|
|
|
1870
2111
|
// ../domain/src/thread-parent-notifications.ts
|
|
1871
|
-
import { z as
|
|
2112
|
+
import { z as z14 } from "zod";
|
|
1872
2113
|
var threadParentNotificationsValues = [
|
|
1873
2114
|
"auto",
|
|
1874
2115
|
"stuck",
|
|
1875
2116
|
"off"
|
|
1876
2117
|
];
|
|
1877
|
-
var threadParentNotificationsSchema =
|
|
2118
|
+
var threadParentNotificationsSchema = z14.enum(
|
|
1878
2119
|
threadParentNotificationsValues
|
|
1879
2120
|
);
|
|
1880
2121
|
|
|
1881
2122
|
// ../domain/src/thread-visibility.ts
|
|
1882
|
-
import { z as
|
|
2123
|
+
import { z as z15 } from "zod";
|
|
1883
2124
|
var threadVisibilityValues = ["visible", "hidden"];
|
|
1884
|
-
var threadVisibilitySchema =
|
|
2125
|
+
var threadVisibilitySchema = z15.enum(threadVisibilityValues);
|
|
1885
2126
|
|
|
1886
2127
|
// ../domain/src/thread-runtime-state.ts
|
|
1887
|
-
import { z as
|
|
2128
|
+
import { z as z16 } from "zod";
|
|
1888
2129
|
var threadRuntimeDisplayStatusValues = [
|
|
1889
2130
|
...threadStatusValues,
|
|
1890
2131
|
"provisioning",
|
|
1891
2132
|
"waiting-for-host"
|
|
1892
2133
|
];
|
|
1893
|
-
var threadRuntimeDisplayStatusSchema =
|
|
2134
|
+
var threadRuntimeDisplayStatusSchema = z16.enum(
|
|
1894
2135
|
threadRuntimeDisplayStatusValues
|
|
1895
2136
|
);
|
|
1896
|
-
var threadRuntimeStateSchema =
|
|
2137
|
+
var threadRuntimeStateSchema = z16.object({
|
|
1897
2138
|
displayStatus: threadRuntimeDisplayStatusSchema
|
|
1898
2139
|
});
|
|
1899
|
-
var threadActivityStateSchema =
|
|
1900
|
-
activeWorkflowCount:
|
|
1901
|
-
activeBackgroundAgentCount:
|
|
1902
|
-
activeBackgroundCommandCount:
|
|
1903
|
-
activePlanModeCount:
|
|
2140
|
+
var threadActivityStateSchema = z16.object({
|
|
2141
|
+
activeWorkflowCount: z16.number().int().nonnegative(),
|
|
2142
|
+
activeBackgroundAgentCount: z16.number().int().nonnegative(),
|
|
2143
|
+
activeBackgroundCommandCount: z16.number().int().nonnegative(),
|
|
2144
|
+
activePlanModeCount: z16.number().int().nonnegative()
|
|
1904
2145
|
});
|
|
1905
2146
|
|
|
1906
2147
|
// ../domain/src/thread.ts
|
|
1907
|
-
var threadQueuedMessageSchema =
|
|
1908
|
-
id:
|
|
2148
|
+
var threadQueuedMessageSchema = z17.object({
|
|
2149
|
+
id: z17.string(),
|
|
1909
2150
|
origin: threadCreateOriginSchema.nullable(),
|
|
1910
|
-
originPluginId:
|
|
1911
|
-
initiator:
|
|
1912
|
-
senderThreadId:
|
|
2151
|
+
originPluginId: z17.string().nullable(),
|
|
2152
|
+
initiator: z17.enum(["user", "agent", "system"]),
|
|
2153
|
+
senderThreadId: z17.string().nullable(),
|
|
1913
2154
|
/**
|
|
1914
2155
|
* The thread this row is waiting on. Redundant on the thread-scoped list
|
|
1915
2156
|
* route that first served this DTO, and load-bearing everywhere else it is
|
|
1916
2157
|
* now served: a `queue.*` plugin event and a cross-thread wait-holder query
|
|
1917
2158
|
* both hand out rows with no surrounding thread to read it from.
|
|
1918
2159
|
*/
|
|
1919
|
-
threadId:
|
|
1920
|
-
content:
|
|
1921
|
-
model:
|
|
2160
|
+
threadId: z17.string(),
|
|
2161
|
+
content: z17.array(promptInputSchema).min(1),
|
|
2162
|
+
model: z17.string().min(1),
|
|
1922
2163
|
reasoningLevel: reasoningLevelSchema,
|
|
1923
2164
|
permissionMode: permissionModeSchema,
|
|
1924
2165
|
serviceTier: serviceTierSchema,
|
|
1925
|
-
groupWithNext:
|
|
2166
|
+
groupWithNext: z17.boolean(),
|
|
1926
2167
|
/**
|
|
1927
2168
|
* Epoch ms this row is scheduled to attempt dispatch, or null when it is
|
|
1928
2169
|
* eligible as soon as its other waits clear.
|
|
1929
2170
|
*/
|
|
1930
|
-
sendAt:
|
|
2171
|
+
sendAt: z17.number().int().nonnegative().nullable(),
|
|
1931
2172
|
state: queuedMessageStateSchema,
|
|
1932
2173
|
/**
|
|
1933
2174
|
* Why this row is queued, or null for a `queued` row that is simply next in
|
|
@@ -1956,50 +2197,50 @@ var threadQueuedMessageSchema = z16.object({
|
|
|
1956
2197
|
* not something a client should reason about. The server folds both into
|
|
1957
2198
|
* this one answer.
|
|
1958
2199
|
*/
|
|
1959
|
-
editable:
|
|
1960
|
-
createdAt:
|
|
1961
|
-
updatedAt:
|
|
2200
|
+
editable: z17.boolean(),
|
|
2201
|
+
createdAt: z17.number(),
|
|
2202
|
+
updatedAt: z17.number()
|
|
1962
2203
|
});
|
|
1963
|
-
var threadSchema =
|
|
1964
|
-
id:
|
|
1965
|
-
projectId:
|
|
1966
|
-
environmentId:
|
|
1967
|
-
providerId:
|
|
1968
|
-
title:
|
|
1969
|
-
titleFallback:
|
|
1970
|
-
sectionId:
|
|
2204
|
+
var threadSchema = z17.object({
|
|
2205
|
+
id: z17.string(),
|
|
2206
|
+
projectId: z17.string(),
|
|
2207
|
+
environmentId: z17.string().nullable(),
|
|
2208
|
+
providerId: z17.string(),
|
|
2209
|
+
title: z17.string().nullable(),
|
|
2210
|
+
titleFallback: z17.string().nullable(),
|
|
2211
|
+
sectionId: z17.string().nullable(),
|
|
1971
2212
|
status: threadStatusSchema,
|
|
1972
|
-
parentThreadId:
|
|
1973
|
-
lifecycleOwnerThreadId:
|
|
1974
|
-
sourceThreadId:
|
|
2213
|
+
parentThreadId: z17.string().nullable(),
|
|
2214
|
+
lifecycleOwnerThreadId: z17.string().nullable(),
|
|
2215
|
+
sourceThreadId: z17.string().nullable(),
|
|
1975
2216
|
originKind: threadOriginKindSchema.nullable(),
|
|
1976
|
-
originPluginId:
|
|
2217
|
+
originPluginId: z17.string().nullable(),
|
|
1977
2218
|
visibility: threadVisibilitySchema,
|
|
1978
2219
|
parentNotifications: threadParentNotificationsSchema,
|
|
1979
|
-
archivedAt:
|
|
1980
|
-
pinnedAt:
|
|
1981
|
-
deletedAt:
|
|
1982
|
-
lastReadAt:
|
|
1983
|
-
latestAttentionAt:
|
|
1984
|
-
createdAt:
|
|
1985
|
-
updatedAt:
|
|
2220
|
+
archivedAt: z17.number().nullable(),
|
|
2221
|
+
pinnedAt: z17.number().nullable(),
|
|
2222
|
+
deletedAt: z17.number().nullable(),
|
|
2223
|
+
lastReadAt: z17.number().nullable(),
|
|
2224
|
+
latestAttentionAt: z17.number(),
|
|
2225
|
+
createdAt: z17.number(),
|
|
2226
|
+
updatedAt: z17.number()
|
|
1986
2227
|
});
|
|
1987
2228
|
var threadWithRuntimeSchema = threadSchema.extend({
|
|
1988
2229
|
runtime: threadRuntimeStateSchema
|
|
1989
2230
|
});
|
|
1990
2231
|
var threadQueuedWorkValues = ["none", "waiting", "failed"];
|
|
1991
|
-
var threadQueuedWorkSchema =
|
|
2232
|
+
var threadQueuedWorkSchema = z17.enum(threadQueuedWorkValues);
|
|
1992
2233
|
var threadListEntrySchema = threadWithRuntimeSchema.extend({
|
|
1993
2234
|
activity: threadActivityStateSchema,
|
|
1994
2235
|
queuedWork: threadQueuedWorkSchema,
|
|
1995
|
-
pinSortKey:
|
|
1996
|
-
hasPendingInteraction:
|
|
1997
|
-
environmentHostId:
|
|
1998
|
-
environmentName:
|
|
1999
|
-
environmentBranchName:
|
|
2000
|
-
environmentPath:
|
|
2001
|
-
environmentProviderId:
|
|
2002
|
-
environmentIsWorktree:
|
|
2236
|
+
pinSortKey: z17.string().nullable(),
|
|
2237
|
+
hasPendingInteraction: z17.boolean(),
|
|
2238
|
+
environmentHostId: z17.string().nullable(),
|
|
2239
|
+
environmentName: z17.string().nullable(),
|
|
2240
|
+
environmentBranchName: z17.string().nullable(),
|
|
2241
|
+
environmentPath: z17.string().nullable(),
|
|
2242
|
+
environmentProviderId: z17.string().nullable(),
|
|
2243
|
+
environmentIsWorktree: z17.boolean().nullable(),
|
|
2003
2244
|
environmentWorkspaceDisplayKind: environmentWorkspaceDisplayKindSchema
|
|
2004
2245
|
});
|
|
2005
2246
|
|
|
@@ -2059,16 +2300,16 @@ var SYSTEM_CHANGE_KINDS = [
|
|
|
2059
2300
|
"server-move-changed",
|
|
2060
2301
|
"app-update-changed"
|
|
2061
2302
|
];
|
|
2062
|
-
var threadChangeKindSchema =
|
|
2063
|
-
var projectChangeKindSchema =
|
|
2064
|
-
var environmentChangeKindSchema =
|
|
2065
|
-
var hostChangeKindSchema =
|
|
2066
|
-
var systemChangeKindSchema =
|
|
2067
|
-
var threadTimelineSubscriptionTargetSchema =
|
|
2068
|
-
kind:
|
|
2069
|
-
threadId:
|
|
2070
|
-
segmentLimit:
|
|
2071
|
-
deferContent:
|
|
2303
|
+
var threadChangeKindSchema = z18.enum(THREAD_CHANGE_KINDS);
|
|
2304
|
+
var projectChangeKindSchema = z18.enum(PROJECT_CHANGE_KINDS);
|
|
2305
|
+
var environmentChangeKindSchema = z18.enum(ENVIRONMENT_CHANGE_KINDS);
|
|
2306
|
+
var hostChangeKindSchema = z18.enum(HOST_CHANGE_KINDS);
|
|
2307
|
+
var systemChangeKindSchema = z18.enum(SYSTEM_CHANGE_KINDS);
|
|
2308
|
+
var threadTimelineSubscriptionTargetSchema = z18.object({
|
|
2309
|
+
kind: z18.literal("thread-timeline"),
|
|
2310
|
+
threadId: z18.string().min(1),
|
|
2311
|
+
segmentLimit: z18.number().int().positive().nullable(),
|
|
2312
|
+
deferContent: z18.boolean()
|
|
2072
2313
|
}).strict();
|
|
2073
2314
|
function canonicalPluginReadInput(value) {
|
|
2074
2315
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
@@ -2078,62 +2319,62 @@ function canonicalPluginReadInput(value) {
|
|
|
2078
2319
|
(key) => `${JSON.stringify(key)}:${canonicalPluginReadInput(value[key])}`
|
|
2079
2320
|
).join(",")}}`;
|
|
2080
2321
|
}
|
|
2081
|
-
var pluginReadSubscriptionTargetSchema =
|
|
2082
|
-
kind:
|
|
2083
|
-
pluginId:
|
|
2084
|
-
method:
|
|
2085
|
-
read:
|
|
2086
|
-
|
|
2087
|
-
|
|
2322
|
+
var pluginReadSubscriptionTargetSchema = z18.object({
|
|
2323
|
+
kind: z18.literal("plugin-read"),
|
|
2324
|
+
pluginId: z18.string().min(1),
|
|
2325
|
+
method: z18.string().min(1),
|
|
2326
|
+
read: z18.union([
|
|
2327
|
+
z18.object({ input: jsonValueSchema }).strict(),
|
|
2328
|
+
z18.object({ key: z18.string() }).strict()
|
|
2088
2329
|
]).refine(
|
|
2089
2330
|
(read) => new TextEncoder().encode(canonicalPluginReadInput(read)).byteLength <= 16384,
|
|
2090
2331
|
"Plugin read input exceeds 16 KiB"
|
|
2091
2332
|
)
|
|
2092
2333
|
}).strict();
|
|
2093
|
-
var realtimeSubscriptionTargetSchema =
|
|
2334
|
+
var realtimeSubscriptionTargetSchema = z18.discriminatedUnion("kind", [
|
|
2094
2335
|
pluginReadSubscriptionTargetSchema,
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
kind:
|
|
2098
|
-
threadId:
|
|
2336
|
+
z18.object({ kind: z18.literal("plugin"), pluginId: z18.string().min(1) }).strict(),
|
|
2337
|
+
z18.object({
|
|
2338
|
+
kind: z18.literal("thread-detail"),
|
|
2339
|
+
threadId: z18.string().min(1)
|
|
2099
2340
|
}).strict(),
|
|
2100
2341
|
threadTimelineSubscriptionTargetSchema,
|
|
2101
|
-
|
|
2102
|
-
kind:
|
|
2342
|
+
z18.object({
|
|
2343
|
+
kind: z18.literal("thread-list")
|
|
2103
2344
|
}).strict(),
|
|
2104
|
-
|
|
2105
|
-
kind:
|
|
2106
|
-
projectId:
|
|
2345
|
+
z18.object({
|
|
2346
|
+
kind: z18.literal("project-detail"),
|
|
2347
|
+
projectId: z18.string().min(1)
|
|
2107
2348
|
}).strict(),
|
|
2108
|
-
|
|
2109
|
-
kind:
|
|
2349
|
+
z18.object({
|
|
2350
|
+
kind: z18.literal("project-list")
|
|
2110
2351
|
}).strict(),
|
|
2111
|
-
|
|
2112
|
-
kind:
|
|
2113
|
-
environmentId:
|
|
2352
|
+
z18.object({
|
|
2353
|
+
kind: z18.literal("environment-detail"),
|
|
2354
|
+
environmentId: z18.string().min(1)
|
|
2114
2355
|
}).strict(),
|
|
2115
|
-
|
|
2116
|
-
kind:
|
|
2356
|
+
z18.object({
|
|
2357
|
+
kind: z18.literal("environment-list")
|
|
2117
2358
|
}).strict(),
|
|
2118
|
-
|
|
2119
|
-
kind:
|
|
2120
|
-
hostId:
|
|
2359
|
+
z18.object({
|
|
2360
|
+
kind: z18.literal("host-detail"),
|
|
2361
|
+
hostId: z18.string().min(1)
|
|
2121
2362
|
}).strict(),
|
|
2122
|
-
|
|
2123
|
-
kind:
|
|
2363
|
+
z18.object({
|
|
2364
|
+
kind: z18.literal("host-list")
|
|
2124
2365
|
}).strict(),
|
|
2125
|
-
|
|
2126
|
-
kind:
|
|
2366
|
+
z18.object({
|
|
2367
|
+
kind: z18.literal("system")
|
|
2127
2368
|
}).strict()
|
|
2128
2369
|
]);
|
|
2129
2370
|
function isValidSubscriptionTarget(value) {
|
|
2130
2371
|
return realtimeSubscriptionTargetSchema.safeParse(value).success;
|
|
2131
2372
|
}
|
|
2132
|
-
var validSubscriptionTargetsSchema =
|
|
2373
|
+
var validSubscriptionTargetsSchema = z18.preprocess(
|
|
2133
2374
|
(value) => Array.isArray(value) ? value.filter(isValidSubscriptionTarget) : value,
|
|
2134
|
-
|
|
2375
|
+
z18.array(realtimeSubscriptionTargetSchema)
|
|
2135
2376
|
);
|
|
2136
|
-
var validSubscriptionTargetSchema =
|
|
2377
|
+
var validSubscriptionTargetSchema = z18.preprocess(
|
|
2137
2378
|
(value) => value === void 0 || isValidSubscriptionTarget(value) ? value : null,
|
|
2138
2379
|
realtimeSubscriptionTargetSchema.nullable().optional()
|
|
2139
2380
|
);
|
|
@@ -2142,83 +2383,83 @@ var subscriptionFields = {
|
|
|
2142
2383
|
targets: validSubscriptionTargetsSchema.optional()
|
|
2143
2384
|
};
|
|
2144
2385
|
var hasSubscriptionTargets = (value) => value.target !== void 0 !== (value.targets !== void 0);
|
|
2145
|
-
var subscribeMessageSchema =
|
|
2146
|
-
type:
|
|
2386
|
+
var subscribeMessageSchema = z18.object({
|
|
2387
|
+
type: z18.literal("subscribe"),
|
|
2147
2388
|
...subscriptionFields,
|
|
2148
|
-
timelineTags:
|
|
2389
|
+
timelineTags: z18.record(z18.string(), z18.string().min(1).nullable()).optional()
|
|
2149
2390
|
}).refine(hasSubscriptionTargets);
|
|
2150
|
-
var unsubscribeMessageSchema =
|
|
2151
|
-
var pingMessageSchema =
|
|
2152
|
-
type:
|
|
2391
|
+
var unsubscribeMessageSchema = z18.object({ type: z18.literal("unsubscribe"), ...subscriptionFields }).refine(hasSubscriptionTargets);
|
|
2392
|
+
var pingMessageSchema = z18.object({
|
|
2393
|
+
type: z18.literal("ping")
|
|
2153
2394
|
});
|
|
2154
|
-
var visibilityMessageSchema =
|
|
2155
|
-
type:
|
|
2156
|
-
visible:
|
|
2395
|
+
var visibilityMessageSchema = z18.object({
|
|
2396
|
+
type: z18.literal("visibility"),
|
|
2397
|
+
visible: z18.boolean()
|
|
2157
2398
|
});
|
|
2158
|
-
var clientMessageSchema =
|
|
2399
|
+
var clientMessageSchema = z18.discriminatedUnion("type", [
|
|
2159
2400
|
subscribeMessageSchema,
|
|
2160
2401
|
unsubscribeMessageSchema,
|
|
2161
2402
|
pingMessageSchema,
|
|
2162
2403
|
visibilityMessageSchema
|
|
2163
2404
|
]);
|
|
2164
|
-
var pongMessageSchema =
|
|
2165
|
-
type:
|
|
2405
|
+
var pongMessageSchema = z18.object({
|
|
2406
|
+
type: z18.literal("pong")
|
|
2166
2407
|
}).strict();
|
|
2167
|
-
var pongMessageLenientSchema =
|
|
2168
|
-
type:
|
|
2408
|
+
var pongMessageLenientSchema = z18.object({
|
|
2409
|
+
type: z18.literal("pong")
|
|
2169
2410
|
});
|
|
2170
|
-
var threadStatusChangeMetadataSchema =
|
|
2411
|
+
var threadStatusChangeMetadataSchema = z18.object({
|
|
2171
2412
|
status: threadStatusSchema,
|
|
2172
2413
|
runtime: threadRuntimeStateSchema,
|
|
2173
2414
|
activity: threadActivityStateSchema,
|
|
2174
|
-
latestAttentionAt:
|
|
2175
|
-
updatedAt:
|
|
2415
|
+
latestAttentionAt: z18.number(),
|
|
2416
|
+
updatedAt: z18.number()
|
|
2176
2417
|
}).strict();
|
|
2177
|
-
var threadChangeMetadataSchema =
|
|
2178
|
-
backgroundActivityChanged:
|
|
2179
|
-
eventTypes:
|
|
2180
|
-
timelineSequence:
|
|
2181
|
-
hasPendingInteraction:
|
|
2182
|
-
projectId:
|
|
2418
|
+
var threadChangeMetadataSchema = z18.object({
|
|
2419
|
+
backgroundActivityChanged: z18.boolean().optional(),
|
|
2420
|
+
eventTypes: z18.array(threadEventTypeSchema).readonly().optional(),
|
|
2421
|
+
timelineSequence: z18.number().int().nonnegative().optional(),
|
|
2422
|
+
hasPendingInteraction: z18.boolean().optional(),
|
|
2423
|
+
projectId: z18.string().optional(),
|
|
2183
2424
|
statusChange: threadStatusChangeMetadataSchema.optional()
|
|
2184
2425
|
}).strict();
|
|
2185
|
-
var threadChangedMessageSchema =
|
|
2186
|
-
type:
|
|
2187
|
-
entity:
|
|
2188
|
-
id:
|
|
2426
|
+
var threadChangedMessageSchema = z18.object({
|
|
2427
|
+
type: z18.literal("changed"),
|
|
2428
|
+
entity: z18.literal("thread"),
|
|
2429
|
+
id: z18.string().optional(),
|
|
2189
2430
|
metadata: threadChangeMetadataSchema.optional(),
|
|
2190
|
-
changes:
|
|
2431
|
+
changes: z18.array(threadChangeKindSchema).readonly()
|
|
2191
2432
|
}).strict();
|
|
2192
|
-
var projectChangedMessageSchema =
|
|
2193
|
-
type:
|
|
2194
|
-
entity:
|
|
2195
|
-
id:
|
|
2196
|
-
changes:
|
|
2433
|
+
var projectChangedMessageSchema = z18.object({
|
|
2434
|
+
type: z18.literal("changed"),
|
|
2435
|
+
entity: z18.literal("project"),
|
|
2436
|
+
id: z18.string().optional(),
|
|
2437
|
+
changes: z18.array(projectChangeKindSchema).readonly()
|
|
2197
2438
|
}).strict();
|
|
2198
|
-
var environmentChangedMessageSchema =
|
|
2199
|
-
type:
|
|
2200
|
-
entity:
|
|
2201
|
-
id:
|
|
2202
|
-
changes:
|
|
2439
|
+
var environmentChangedMessageSchema = z18.object({
|
|
2440
|
+
type: z18.literal("changed"),
|
|
2441
|
+
entity: z18.literal("environment"),
|
|
2442
|
+
id: z18.string().optional(),
|
|
2443
|
+
changes: z18.array(environmentChangeKindSchema).readonly()
|
|
2203
2444
|
}).strict();
|
|
2204
|
-
var hostChangedMessageSchema =
|
|
2205
|
-
type:
|
|
2206
|
-
entity:
|
|
2207
|
-
id:
|
|
2208
|
-
changes:
|
|
2445
|
+
var hostChangedMessageSchema = z18.object({
|
|
2446
|
+
type: z18.literal("changed"),
|
|
2447
|
+
entity: z18.literal("host"),
|
|
2448
|
+
id: z18.string().optional(),
|
|
2449
|
+
changes: z18.array(hostChangeKindSchema).readonly()
|
|
2209
2450
|
}).strict();
|
|
2210
|
-
var systemChangedMessageSchema =
|
|
2211
|
-
type:
|
|
2212
|
-
entity:
|
|
2213
|
-
changes:
|
|
2451
|
+
var systemChangedMessageSchema = z18.object({
|
|
2452
|
+
type: z18.literal("changed"),
|
|
2453
|
+
entity: z18.literal("system"),
|
|
2454
|
+
changes: z18.array(systemChangeKindSchema).readonly()
|
|
2214
2455
|
}).strict();
|
|
2215
|
-
var pluginChangedMessageSchema =
|
|
2216
|
-
type:
|
|
2217
|
-
entity:
|
|
2218
|
-
pluginId:
|
|
2219
|
-
tags:
|
|
2456
|
+
var pluginChangedMessageSchema = z18.object({
|
|
2457
|
+
type: z18.literal("changed"),
|
|
2458
|
+
entity: z18.literal("plugin"),
|
|
2459
|
+
pluginId: z18.string().min(1),
|
|
2460
|
+
tags: z18.array(z18.string().min(1)).min(1).nullable()
|
|
2220
2461
|
}).strict();
|
|
2221
|
-
var changedMessageSchema =
|
|
2462
|
+
var changedMessageSchema = z18.discriminatedUnion("entity", [
|
|
2222
2463
|
threadChangedMessageSchema,
|
|
2223
2464
|
projectChangedMessageSchema,
|
|
2224
2465
|
environmentChangedMessageSchema,
|
|
@@ -2228,56 +2469,56 @@ var changedMessageSchema = z17.discriminatedUnion("entity", [
|
|
|
2228
2469
|
]);
|
|
2229
2470
|
function lenientKinds(kinds) {
|
|
2230
2471
|
const known = new Set(kinds);
|
|
2231
|
-
return
|
|
2472
|
+
return z18.array(z18.string()).transform(
|
|
2232
2473
|
(values) => values.filter((value) => known.has(value))
|
|
2233
2474
|
);
|
|
2234
2475
|
}
|
|
2235
2476
|
var knownThreadEventTypes = new Set(
|
|
2236
2477
|
threadEventTypeValues
|
|
2237
2478
|
);
|
|
2238
|
-
var threadChangeMetadataLenientSchema =
|
|
2239
|
-
timelineSequence:
|
|
2240
|
-
backgroundActivityChanged:
|
|
2241
|
-
eventTypes:
|
|
2479
|
+
var threadChangeMetadataLenientSchema = z18.object({
|
|
2480
|
+
timelineSequence: z18.number().int().nonnegative().optional(),
|
|
2481
|
+
backgroundActivityChanged: z18.boolean().optional(),
|
|
2482
|
+
eventTypes: z18.array(z18.string()).transform(
|
|
2242
2483
|
(values) => values.filter(
|
|
2243
2484
|
(value) => knownThreadEventTypes.has(value)
|
|
2244
2485
|
)
|
|
2245
2486
|
).optional(),
|
|
2246
|
-
hasPendingInteraction:
|
|
2247
|
-
projectId:
|
|
2487
|
+
hasPendingInteraction: z18.boolean().optional(),
|
|
2488
|
+
projectId: z18.string().optional(),
|
|
2248
2489
|
statusChange: threadStatusChangeMetadataSchema.optional().catch(void 0)
|
|
2249
2490
|
});
|
|
2250
|
-
var threadChangedMessageLenientSchema =
|
|
2251
|
-
type:
|
|
2252
|
-
entity:
|
|
2253
|
-
id:
|
|
2491
|
+
var threadChangedMessageLenientSchema = z18.object({
|
|
2492
|
+
type: z18.literal("changed"),
|
|
2493
|
+
entity: z18.literal("thread"),
|
|
2494
|
+
id: z18.string().optional(),
|
|
2254
2495
|
metadata: threadChangeMetadataLenientSchema.optional(),
|
|
2255
2496
|
changes: lenientKinds(THREAD_CHANGE_KINDS)
|
|
2256
2497
|
});
|
|
2257
|
-
var projectChangedMessageLenientSchema =
|
|
2258
|
-
type:
|
|
2259
|
-
entity:
|
|
2260
|
-
id:
|
|
2498
|
+
var projectChangedMessageLenientSchema = z18.object({
|
|
2499
|
+
type: z18.literal("changed"),
|
|
2500
|
+
entity: z18.literal("project"),
|
|
2501
|
+
id: z18.string().optional(),
|
|
2261
2502
|
changes: lenientKinds(PROJECT_CHANGE_KINDS)
|
|
2262
2503
|
});
|
|
2263
|
-
var environmentChangedMessageLenientSchema =
|
|
2264
|
-
type:
|
|
2265
|
-
entity:
|
|
2266
|
-
id:
|
|
2504
|
+
var environmentChangedMessageLenientSchema = z18.object({
|
|
2505
|
+
type: z18.literal("changed"),
|
|
2506
|
+
entity: z18.literal("environment"),
|
|
2507
|
+
id: z18.string().optional(),
|
|
2267
2508
|
changes: lenientKinds(ENVIRONMENT_CHANGE_KINDS)
|
|
2268
2509
|
});
|
|
2269
|
-
var hostChangedMessageLenientSchema =
|
|
2270
|
-
type:
|
|
2271
|
-
entity:
|
|
2272
|
-
id:
|
|
2510
|
+
var hostChangedMessageLenientSchema = z18.object({
|
|
2511
|
+
type: z18.literal("changed"),
|
|
2512
|
+
entity: z18.literal("host"),
|
|
2513
|
+
id: z18.string().optional(),
|
|
2273
2514
|
changes: lenientKinds(HOST_CHANGE_KINDS)
|
|
2274
2515
|
});
|
|
2275
|
-
var systemChangedMessageLenientSchema =
|
|
2276
|
-
type:
|
|
2277
|
-
entity:
|
|
2516
|
+
var systemChangedMessageLenientSchema = z18.object({
|
|
2517
|
+
type: z18.literal("changed"),
|
|
2518
|
+
entity: z18.literal("system"),
|
|
2278
2519
|
changes: lenientKinds(SYSTEM_CHANGE_KINDS)
|
|
2279
2520
|
});
|
|
2280
|
-
var changedMessageLenientSchema =
|
|
2521
|
+
var changedMessageLenientSchema = z18.discriminatedUnion("entity", [
|
|
2281
2522
|
threadChangedMessageLenientSchema,
|
|
2282
2523
|
projectChangedMessageLenientSchema,
|
|
2283
2524
|
environmentChangedMessageLenientSchema,
|
|
@@ -2286,23 +2527,40 @@ var changedMessageLenientSchema = z17.discriminatedUnion("entity", [
|
|
|
2286
2527
|
pluginChangedMessageSchema.strip()
|
|
2287
2528
|
]);
|
|
2288
2529
|
|
|
2530
|
+
// ../text-utils/src/utf16.ts
|
|
2531
|
+
function isHighSurrogateAt(value, index) {
|
|
2532
|
+
const code = value.charCodeAt(index);
|
|
2533
|
+
return code >= 55296 && code <= 56319;
|
|
2534
|
+
}
|
|
2535
|
+
function isLowSurrogateAt(value, index) {
|
|
2536
|
+
const code = value.charCodeAt(index);
|
|
2537
|
+
return code >= 56320 && code <= 57343;
|
|
2538
|
+
}
|
|
2539
|
+
function sliceUtf16Head(value, maxChars) {
|
|
2540
|
+
let end = Math.min(value.length, Math.max(0, maxChars));
|
|
2541
|
+
if (isHighSurrogateAt(value, end - 1) && isLowSurrogateAt(value, end)) {
|
|
2542
|
+
end -= 1;
|
|
2543
|
+
}
|
|
2544
|
+
return value.slice(0, end);
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2289
2547
|
// src/internal/rpc-tags.ts
|
|
2290
|
-
import { z as
|
|
2291
|
-
var rpcInvalidationTags =
|
|
2548
|
+
import { z as z19 } from "zod";
|
|
2549
|
+
var rpcInvalidationTags = z19.array(z19.string().min(1)).min(1);
|
|
2292
2550
|
function rpcResponseTags(declarations, input, output) {
|
|
2293
|
-
const tags =
|
|
2551
|
+
const tags = z19.array(z19.string().min(1)).parse(declarations.tags?.(input, output) ?? []);
|
|
2294
2552
|
const keyTags = {};
|
|
2295
2553
|
if (declarations.keyTags && typeof output === "object" && output !== null && !Array.isArray(output)) {
|
|
2296
2554
|
for (const [key, value] of Object.entries(output)) {
|
|
2297
|
-
keyTags[key] =
|
|
2555
|
+
keyTags[key] = z19.array(z19.string().min(1)).parse(declarations.keyTags(key, value));
|
|
2298
2556
|
}
|
|
2299
2557
|
}
|
|
2300
|
-
const invalidated =
|
|
2558
|
+
const invalidated = z19.array(z19.string().min(1)).parse(declarations.invalidates?.(input, output) ?? []);
|
|
2301
2559
|
return { tags, keyTags, invalidated };
|
|
2302
2560
|
}
|
|
2303
2561
|
|
|
2304
2562
|
// src/internal/rpc-query-host.ts
|
|
2305
|
-
import { z as
|
|
2563
|
+
import { z as z20 } from "zod";
|
|
2306
2564
|
var rpcQueryKey = (pluginId, method, input) => [
|
|
2307
2565
|
"plugin-rpc",
|
|
2308
2566
|
pluginId,
|
|
@@ -2310,8 +2568,8 @@ var rpcQueryKey = (pluginId, method, input) => [
|
|
|
2310
2568
|
input
|
|
2311
2569
|
];
|
|
2312
2570
|
var keyedQueryKey = (pluginId, method) => rpcQueryKey(pluginId, method, { keyed: true });
|
|
2313
|
-
var keyListSchema =
|
|
2314
|
-
var jsonRecordSchema =
|
|
2571
|
+
var keyListSchema = z20.array(z20.string());
|
|
2572
|
+
var jsonRecordSchema = z20.record(z20.string(), jsonValueSchema);
|
|
2315
2573
|
var keyedCollections = /* @__PURE__ */ new Map();
|
|
2316
2574
|
function keyedCollection(pluginId, method) {
|
|
2317
2575
|
const name = JSON.stringify([pluginId, method]);
|
|
@@ -2720,71 +2978,71 @@ function reconcileComposerMentions(currentText, nextText, mentions) {
|
|
|
2720
2978
|
}
|
|
2721
2979
|
|
|
2722
2980
|
// src/internal/composer-draft-actions.ts
|
|
2723
|
-
import { z as
|
|
2981
|
+
import { z as z21 } from "zod";
|
|
2724
2982
|
var range = {
|
|
2725
|
-
from:
|
|
2726
|
-
to:
|
|
2727
|
-
label:
|
|
2983
|
+
from: z21.number().int().nonnegative(),
|
|
2984
|
+
to: z21.number().int().nonnegative(),
|
|
2985
|
+
label: z21.string()
|
|
2728
2986
|
};
|
|
2729
|
-
var mentionSchema =
|
|
2730
|
-
|
|
2987
|
+
var mentionSchema = z21.discriminatedUnion("kind", [
|
|
2988
|
+
z21.object({
|
|
2731
2989
|
...range,
|
|
2732
|
-
kind:
|
|
2733
|
-
threadId:
|
|
2734
|
-
projectId:
|
|
2990
|
+
kind: z21.literal("thread"),
|
|
2991
|
+
threadId: z21.string(),
|
|
2992
|
+
projectId: z21.string().optional()
|
|
2735
2993
|
}),
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2994
|
+
z21.object({ ...range, kind: z21.literal("project"), projectId: z21.string() }),
|
|
2995
|
+
z21.object({ ...range, kind: z21.literal("section"), sectionId: z21.string() }),
|
|
2996
|
+
z21.object({
|
|
2739
2997
|
...range,
|
|
2740
|
-
kind:
|
|
2741
|
-
path:
|
|
2742
|
-
source:
|
|
2743
|
-
entryKind:
|
|
2998
|
+
kind: z21.literal("path"),
|
|
2999
|
+
path: z21.string(),
|
|
3000
|
+
source: z21.enum(["workspace", "thread-storage"]),
|
|
3001
|
+
entryKind: z21.enum(["file", "directory"])
|
|
2744
3002
|
}),
|
|
2745
|
-
|
|
3003
|
+
z21.object({
|
|
2746
3004
|
...range,
|
|
2747
|
-
kind:
|
|
2748
|
-
trigger:
|
|
2749
|
-
name:
|
|
2750
|
-
source:
|
|
2751
|
-
origin:
|
|
2752
|
-
argumentHint:
|
|
3005
|
+
kind: z21.literal("command"),
|
|
3006
|
+
trigger: z21.enum(["/", "$"]),
|
|
3007
|
+
name: z21.string(),
|
|
3008
|
+
source: z21.enum(["skill", "command"]),
|
|
3009
|
+
origin: z21.enum(["builtin", "project", "user"]),
|
|
3010
|
+
argumentHint: z21.string().nullable()
|
|
2753
3011
|
}),
|
|
2754
|
-
|
|
2755
|
-
|
|
3012
|
+
z21.object({ ...range, kind: z21.literal("attachment"), path: z21.string() }),
|
|
3013
|
+
z21.object({
|
|
2756
3014
|
...range,
|
|
2757
|
-
kind:
|
|
2758
|
-
pluginId:
|
|
2759
|
-
provider:
|
|
2760
|
-
id:
|
|
2761
|
-
icon:
|
|
3015
|
+
kind: z21.literal("plugin"),
|
|
3016
|
+
pluginId: z21.string(),
|
|
3017
|
+
provider: z21.string().min(1).refine((value) => !value.includes(":")),
|
|
3018
|
+
id: z21.string(),
|
|
3019
|
+
icon: z21.string().nullable().optional()
|
|
2762
3020
|
})
|
|
2763
3021
|
]);
|
|
2764
3022
|
var attachmentFields = {
|
|
2765
|
-
type:
|
|
2766
|
-
path:
|
|
2767
|
-
name:
|
|
2768
|
-
mimeType:
|
|
2769
|
-
sizeBytes:
|
|
3023
|
+
type: z21.enum(["localImage", "localFile"]),
|
|
3024
|
+
path: z21.string().min(1),
|
|
3025
|
+
name: z21.string(),
|
|
3026
|
+
mimeType: z21.string().optional(),
|
|
3027
|
+
sizeBytes: z21.number().nonnegative().optional()
|
|
2770
3028
|
};
|
|
2771
|
-
var attachmentsSchema =
|
|
2772
|
-
|
|
2773
|
-
|
|
3029
|
+
var attachmentsSchema = z21.array(
|
|
3030
|
+
z21.union([
|
|
3031
|
+
z21.object({
|
|
2774
3032
|
...attachmentFields,
|
|
2775
|
-
hostId:
|
|
2776
|
-
sourceProjectId:
|
|
3033
|
+
hostId: z21.string().min(1),
|
|
3034
|
+
sourceProjectId: z21.undefined().optional()
|
|
2777
3035
|
}),
|
|
2778
|
-
|
|
3036
|
+
z21.object({
|
|
2779
3037
|
...attachmentFields,
|
|
2780
|
-
sourceProjectId:
|
|
2781
|
-
hostId:
|
|
3038
|
+
sourceProjectId: z21.string().min(1).optional(),
|
|
3039
|
+
hostId: z21.undefined().optional()
|
|
2782
3040
|
})
|
|
2783
3041
|
])
|
|
2784
3042
|
);
|
|
2785
|
-
var replacementSchema =
|
|
2786
|
-
text:
|
|
2787
|
-
mentions:
|
|
3043
|
+
var replacementSchema = z21.object({
|
|
3044
|
+
text: z21.string(),
|
|
3045
|
+
mentions: z21.array(mentionSchema),
|
|
2788
3046
|
attachments: attachmentsSchema.optional()
|
|
2789
3047
|
}).superRefine((draft, context) => {
|
|
2790
3048
|
let end = 0;
|
|
@@ -3792,7 +4050,7 @@ function adaptSidebarFooterAction(registration) {
|
|
|
3792
4050
|
var sidebarFooterItemsByRegistrationSet = /* @__PURE__ */ new WeakMap();
|
|
3793
4051
|
|
|
3794
4052
|
// src/internal/plugin-app-registration-collector.ts
|
|
3795
|
-
import { z as
|
|
4053
|
+
import { z as z22 } from "zod";
|
|
3796
4054
|
var CODE_FENCE_LANGUAGE_PATTERN = /^[a-z0-9][a-z0-9+#._-]*$/;
|
|
3797
4055
|
var SIDEBAR_FOOTER_ACTION_KEYS = /* @__PURE__ */ new Set([
|
|
3798
4056
|
"id",
|
|
@@ -3910,8 +4168,8 @@ function checkStaleNavPanelKeys(kind, registration, onWarning) {
|
|
|
3910
4168
|
}
|
|
3911
4169
|
}
|
|
3912
4170
|
function createCommandShortcutSchema() {
|
|
3913
|
-
return
|
|
3914
|
-
key:
|
|
4171
|
+
return z22.object({
|
|
4172
|
+
key: z22.string().min(1).max(32).refine(
|
|
3915
4173
|
(key) => ![
|
|
3916
4174
|
"Alt",
|
|
3917
4175
|
"Control",
|
|
@@ -3922,16 +4180,32 @@ function createCommandShortcutSchema() {
|
|
|
3922
4180
|
"Unidentified"
|
|
3923
4181
|
].includes(key)
|
|
3924
4182
|
),
|
|
3925
|
-
mod:
|
|
3926
|
-
meta:
|
|
3927
|
-
control:
|
|
3928
|
-
alt:
|
|
3929
|
-
shift:
|
|
4183
|
+
mod: z22.boolean().default(false),
|
|
4184
|
+
meta: z22.boolean().default(false),
|
|
4185
|
+
control: z22.boolean().default(false),
|
|
4186
|
+
alt: z22.boolean().default(false),
|
|
4187
|
+
shift: z22.boolean().default(false)
|
|
3930
4188
|
}).strict().refine(
|
|
3931
4189
|
(shortcut) => shortcut.mod || shortcut.meta || shortcut.control || shortcut.alt || /^F(?:[1-9]|1[0-9]|2[0-4])$/u.test(shortcut.key),
|
|
3932
4190
|
"Use Command, Control, or Alt with a key, or a function key"
|
|
3933
4191
|
);
|
|
3934
4192
|
}
|
|
4193
|
+
var MESSAGE_ACTION_SURFACES = [
|
|
4194
|
+
"thread-view",
|
|
4195
|
+
"embedded-chat"
|
|
4196
|
+
];
|
|
4197
|
+
function isMessageActionSurface(value) {
|
|
4198
|
+
return value === "thread-view" || value === "embedded-chat";
|
|
4199
|
+
}
|
|
4200
|
+
function collectMessageActionSurfaces(kind, value) {
|
|
4201
|
+
if (value === void 0) return MESSAGE_ACTION_SURFACES;
|
|
4202
|
+
if (!Array.isArray(value) || value.length === 0 || !value.every(isMessageActionSurface)) {
|
|
4203
|
+
throw new Error(
|
|
4204
|
+
`${kind}: "experimental_surfaces" must be a non-empty array of "thread-view" or "embedded-chat", got ${JSON.stringify(value)}`
|
|
4205
|
+
);
|
|
4206
|
+
}
|
|
4207
|
+
return MESSAGE_ACTION_SURFACES.filter((surface) => value.includes(surface));
|
|
4208
|
+
}
|
|
3935
4209
|
function requireOptionalOrder(kind, order2) {
|
|
3936
4210
|
if (order2 === void 0) return {};
|
|
3937
4211
|
if (!Number.isFinite(order2)) {
|
|
@@ -4108,7 +4382,7 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
4108
4382
|
registration.tooltip
|
|
4109
4383
|
)
|
|
4110
4384
|
},
|
|
4111
|
-
...availability === "action" && registration.params !== void 0 ? { params:
|
|
4385
|
+
...availability === "action" && registration.params !== void 0 ? { params: z22.json().parse(registration.params) } : {}
|
|
4112
4386
|
};
|
|
4113
4387
|
collected.tabs.push(validated);
|
|
4114
4388
|
}
|
|
@@ -4658,6 +4932,10 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
4658
4932
|
...registration.icon !== void 0 ? {
|
|
4659
4933
|
icon: requireNonEmptyString(kind, "icon", registration.icon)
|
|
4660
4934
|
} : {},
|
|
4935
|
+
experimental_surfaces: collectMessageActionSurfaces(
|
|
4936
|
+
kind,
|
|
4937
|
+
registration.experimental_surfaces
|
|
4938
|
+
),
|
|
4661
4939
|
run: registration.run
|
|
4662
4940
|
});
|
|
4663
4941
|
},
|
|
@@ -5908,6 +6186,8 @@ var testPluginSdkApp = {
|
|
|
5908
6186
|
experimental_VoiceRecordingBar: TestVoiceRecordingBar,
|
|
5909
6187
|
experimental_FailedVoiceRecordings: TestFailedVoiceRecordings,
|
|
5910
6188
|
experimental_ShortcutHint: TestShortcutHint,
|
|
6189
|
+
experimental_matchesShortcutKey: matchesAppShortcutKey,
|
|
6190
|
+
experimental_sliceUtf16Head: sliceUtf16Head,
|
|
5911
6191
|
experimental_ImageLightbox: TestImageLightbox,
|
|
5912
6192
|
experimental_PromptMentionIcon: TestPromptMentionIcon,
|
|
5913
6193
|
experimental_describePromptMention(mention) {
|