@ottocode/web-sdk 0.1.286 → 0.1.288
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/browser/BrowserPanelToggle.d.ts +2 -0
- package/dist/components/browser/BrowserPanelToggle.d.ts.map +1 -0
- package/dist/components/browser/BrowserViewerPanel.d.ts +10 -0
- package/dist/components/browser/BrowserViewerPanel.d.ts.map +1 -0
- package/dist/components/browser/index.d.ts +3 -0
- package/dist/components/browser/index.d.ts.map +1 -0
- package/dist/components/common/FileTypeIcon.d.ts +14 -0
- package/dist/components/common/FileTypeIcon.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3230 -2415
- package/dist/components/index.js.map +14 -8
- package/dist/components/messages/renderers/LoadToolsRenderer.d.ts +3 -0
- package/dist/components/messages/renderers/LoadToolsRenderer.d.ts.map +1 -0
- package/dist/components/messages/renderers/SimulatorRenderer.d.ts +3 -0
- package/dist/components/messages/renderers/SimulatorRenderer.d.ts.map +1 -0
- package/dist/components/messages/renderers/index.d.ts.map +1 -1
- package/dist/components/workspace/ViewerTabs.d.ts.map +1 -1
- package/dist/hooks/index.js +144 -11
- package/dist/hooks/index.js.map +4 -4
- package/dist/hooks/useSessionStream.d.ts.map +1 -1
- package/dist/hooks/useSimulator.d.ts +20 -0
- package/dist/hooks/useSimulator.d.ts.map +1 -0
- package/dist/index.js +3253 -2438
- package/dist/index.js.map +14 -8
- package/dist/stores/index.js +116 -11
- package/dist/stores/index.js.map +3 -3
- package/dist/stores/viewerTabsStore.d.ts +19 -0
- package/dist/stores/viewerTabsStore.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadToolsRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/LoadToolsRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAUpD,wBAAgB,iBAAiB,CAAC,EACjC,WAAW,EACX,cAAc,EACd,UAAU,EACV,QAAQ,EACR,OAAO,GACP,EAAE,oBAAoB,2CA0EtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimulatorRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/SimulatorRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AA2CpD,wBAAgB,iBAAiB,CAAC,EACjC,WAAW,EACX,cAAc,EACd,UAAU,EACV,QAAQ,EACR,OAAO,GACP,EAAE,oBAAoB,2CAiJtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/renderers/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA4B3C,UAAU,uBAAuB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AA8DD,wBAAgB,kBAAkB,CAAC,EAClC,QAAQ,EACR,WAAW,EACX,cAAc,EACd,KAAK,EACL,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,OAAO,EACP,SAAS,GACT,EAAE,uBAAuB,2CAmGzB;AAED,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewerTabs.d.ts","sourceRoot":"","sources":["../../../src/components/workspace/ViewerTabs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ViewerTabs.d.ts","sourceRoot":"","sources":["../../../src/components/workspace/ViewerTabs.tsx"],"names":[],"mappings":"AAiPA,eAAO,MAAM,UAAU,8CAwKrB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1346,6 +1346,25 @@ function viewerPathsMatch(left, right) {
|
|
|
1346
1346
|
function fileTabId(path) {
|
|
1347
1347
|
return `file:${normalizeViewerPath(path)}`;
|
|
1348
1348
|
}
|
|
1349
|
+
function browserTabId(kind) {
|
|
1350
|
+
return `browser:${kind}`;
|
|
1351
|
+
}
|
|
1352
|
+
function newBrowserTabId() {
|
|
1353
|
+
return `browser:browser:${Date.now()}:${Math.random().toString(36).slice(2)}`;
|
|
1354
|
+
}
|
|
1355
|
+
function modeForTab(tab) {
|
|
1356
|
+
return tab.type === "browser" ? "preview" : "work";
|
|
1357
|
+
}
|
|
1358
|
+
function findFallbackTabId(tabs, mode, closingIndex) {
|
|
1359
|
+
const next = tabs.slice(closingIndex).find((tab) => modeForTab(tab) === mode);
|
|
1360
|
+
if (next)
|
|
1361
|
+
return next.id;
|
|
1362
|
+
const previous = [...tabs].slice(0, closingIndex).reverse().find((tab) => modeForTab(tab) === mode);
|
|
1363
|
+
return previous?.id ?? null;
|
|
1364
|
+
}
|
|
1365
|
+
function activeIdForWorkUpdate(state, targetId) {
|
|
1366
|
+
return state.activeMode === "preview" && state.activePreviewTabId ? state.activePreviewTabId : targetId;
|
|
1367
|
+
}
|
|
1349
1368
|
function upsertTab(tabs, tab) {
|
|
1350
1369
|
const existingIndex = tabs.findIndex((item) => item.id === tab.id);
|
|
1351
1370
|
if (existingIndex === -1) {
|
|
@@ -1425,9 +1444,19 @@ function upsertAnnotation(annotations, annotation) {
|
|
|
1425
1444
|
var useViewerTabsStore = create((set) => ({
|
|
1426
1445
|
tabs: [],
|
|
1427
1446
|
activeTabId: null,
|
|
1447
|
+
activeMode: "work",
|
|
1448
|
+
activeWorkTabId: null,
|
|
1449
|
+
activePreviewTabId: null,
|
|
1428
1450
|
followToolActivity: false,
|
|
1429
1451
|
toggleFollowToolActivity: () => set((state) => ({ followToolActivity: !state.followToolActivity })),
|
|
1430
1452
|
setFollowToolActivity: (enabled) => set({ followToolActivity: enabled }),
|
|
1453
|
+
setViewerMode: (mode) => set((state) => {
|
|
1454
|
+
const activeTabId = mode === "preview" ? state.activePreviewTabId : state.activeWorkTabId;
|
|
1455
|
+
return {
|
|
1456
|
+
activeMode: mode,
|
|
1457
|
+
activeTabId: activeTabId ?? null
|
|
1458
|
+
};
|
|
1459
|
+
}),
|
|
1431
1460
|
openGitDiffTab: (path, staged) => {
|
|
1432
1461
|
const id = `git-diff:${staged ? "staged" : "unstaged"}:${path}`;
|
|
1433
1462
|
set((state) => ({
|
|
@@ -1438,6 +1467,8 @@ var useViewerTabsStore = create((set) => ({
|
|
|
1438
1467
|
path,
|
|
1439
1468
|
staged
|
|
1440
1469
|
}),
|
|
1470
|
+
activeMode: "work",
|
|
1471
|
+
activeWorkTabId: id,
|
|
1441
1472
|
activeTabId: id
|
|
1442
1473
|
}));
|
|
1443
1474
|
},
|
|
@@ -1452,6 +1483,8 @@ var useViewerTabsStore = create((set) => ({
|
|
|
1452
1483
|
operations,
|
|
1453
1484
|
selectedOperationIndex: Math.max(0, operations.length - 1)
|
|
1454
1485
|
}),
|
|
1486
|
+
activeMode: "work",
|
|
1487
|
+
activeWorkTabId: id,
|
|
1455
1488
|
activeTabId: id
|
|
1456
1489
|
}));
|
|
1457
1490
|
},
|
|
@@ -1474,6 +1507,8 @@ var useViewerTabsStore = create((set) => ({
|
|
|
1474
1507
|
patchPreview: existingFile?.patchPreview,
|
|
1475
1508
|
writePreview: existingFile?.writePreview
|
|
1476
1509
|
}),
|
|
1510
|
+
activeMode: "work",
|
|
1511
|
+
activeWorkTabId: targetId,
|
|
1477
1512
|
activeTabId: targetId
|
|
1478
1513
|
};
|
|
1479
1514
|
});
|
|
@@ -1497,7 +1532,8 @@ var useViewerTabsStore = create((set) => ({
|
|
|
1497
1532
|
patchPreview: undefined,
|
|
1498
1533
|
writePreview: undefined
|
|
1499
1534
|
}),
|
|
1500
|
-
|
|
1535
|
+
activeWorkTabId: targetId,
|
|
1536
|
+
activeTabId: activeIdForWorkUpdate(state, targetId)
|
|
1501
1537
|
};
|
|
1502
1538
|
});
|
|
1503
1539
|
},
|
|
@@ -1546,7 +1582,8 @@ var useViewerTabsStore = create((set) => ({
|
|
|
1546
1582
|
error: preview.error ?? existingPatchPreview?.error
|
|
1547
1583
|
}
|
|
1548
1584
|
}),
|
|
1549
|
-
|
|
1585
|
+
activeWorkTabId: targetId,
|
|
1586
|
+
activeTabId: activeIdForWorkUpdate(state, targetId)
|
|
1550
1587
|
};
|
|
1551
1588
|
}
|
|
1552
1589
|
if (existingFile) {
|
|
@@ -1569,7 +1606,8 @@ var useViewerTabsStore = create((set) => ({
|
|
|
1569
1606
|
error: preview.error ?? existingWritePreview?.error
|
|
1570
1607
|
}
|
|
1571
1608
|
}),
|
|
1572
|
-
|
|
1609
|
+
activeWorkTabId: targetId,
|
|
1610
|
+
activeTabId: activeIdForWorkUpdate(state, targetId)
|
|
1573
1611
|
};
|
|
1574
1612
|
}
|
|
1575
1613
|
const existingWrite = existing?.toolName === "write" ? existing : undefined;
|
|
@@ -1593,7 +1631,8 @@ var useViewerTabsStore = create((set) => ({
|
|
|
1593
1631
|
error: preview.error ?? existingWrite?.error
|
|
1594
1632
|
}
|
|
1595
1633
|
}),
|
|
1596
|
-
|
|
1634
|
+
activeWorkTabId: id,
|
|
1635
|
+
activeTabId: activeIdForWorkUpdate(state, id)
|
|
1597
1636
|
};
|
|
1598
1637
|
});
|
|
1599
1638
|
},
|
|
@@ -1608,23 +1647,89 @@ var useViewerTabsStore = create((set) => ({
|
|
|
1608
1647
|
skill,
|
|
1609
1648
|
file
|
|
1610
1649
|
}),
|
|
1650
|
+
activeMode: "work",
|
|
1651
|
+
activeWorkTabId: id,
|
|
1611
1652
|
activeTabId: id
|
|
1612
1653
|
}));
|
|
1613
1654
|
},
|
|
1614
|
-
|
|
1655
|
+
openBrowserTab: (url = "", options = {}) => {
|
|
1656
|
+
const kind = options.kind ?? "browser";
|
|
1657
|
+
set((state) => {
|
|
1658
|
+
const shouldCreate = kind === "browser" && options.newTab === true;
|
|
1659
|
+
const id = shouldCreate ? newBrowserTabId() : browserTabId(kind);
|
|
1660
|
+
const existing = state.tabs.find((tab) => !shouldCreate && tab.type === "browser" && tab.id === id);
|
|
1661
|
+
return {
|
|
1662
|
+
tabs: upsertTab(state.tabs, {
|
|
1663
|
+
id,
|
|
1664
|
+
type: "browser",
|
|
1665
|
+
title: options.title ?? existing?.title ?? "Browser",
|
|
1666
|
+
url: url || existing?.url || "",
|
|
1667
|
+
kind,
|
|
1668
|
+
reloadKey: existing?.reloadKey ?? 0
|
|
1669
|
+
}),
|
|
1670
|
+
activeMode: "preview",
|
|
1671
|
+
activePreviewTabId: id,
|
|
1672
|
+
activeTabId: id
|
|
1673
|
+
};
|
|
1674
|
+
});
|
|
1675
|
+
},
|
|
1676
|
+
updateBrowserTabUrl: (id, url) => set((state) => ({
|
|
1677
|
+
tabs: state.tabs.map((tab) => tab.id === id && tab.type === "browser" ? {
|
|
1678
|
+
...tab,
|
|
1679
|
+
url,
|
|
1680
|
+
title: tab.kind === "simulator" ? "Simulator" : "Browser"
|
|
1681
|
+
} : tab)
|
|
1682
|
+
})),
|
|
1683
|
+
reloadBrowserTab: (id) => set((state) => ({
|
|
1684
|
+
tabs: state.tabs.map((tab) => tab.id === id && tab.type === "browser" ? { ...tab, reloadKey: tab.reloadKey + 1 } : tab)
|
|
1685
|
+
})),
|
|
1686
|
+
setActiveTab: (id) => set((state) => {
|
|
1687
|
+
const tab = state.tabs.find((item) => item.id === id);
|
|
1688
|
+
const mode = tab ? modeForTab(tab) : state.activeMode;
|
|
1689
|
+
return {
|
|
1690
|
+
activeMode: mode,
|
|
1691
|
+
activeWorkTabId: mode === "work" ? id : state.activeWorkTabId,
|
|
1692
|
+
activePreviewTabId: mode === "preview" ? id : state.activePreviewTabId,
|
|
1693
|
+
activeTabId: id
|
|
1694
|
+
};
|
|
1695
|
+
}),
|
|
1615
1696
|
closeTab: (id) => set((state) => {
|
|
1616
1697
|
const closingIndex = state.tabs.findIndex((tab) => tab.id === id);
|
|
1698
|
+
const closingTab = state.tabs[closingIndex];
|
|
1617
1699
|
const tabs = state.tabs.filter((tab) => tab.id !== id);
|
|
1618
|
-
let
|
|
1619
|
-
|
|
1620
|
-
|
|
1700
|
+
let activeMode = state.activeMode;
|
|
1701
|
+
let activeWorkTabId = state.activeWorkTabId;
|
|
1702
|
+
let activePreviewTabId = state.activePreviewTabId;
|
|
1703
|
+
if (closingTab && modeForTab(closingTab) === "work" && activeWorkTabId === id) {
|
|
1704
|
+
activeWorkTabId = findFallbackTabId(tabs, "work", closingIndex);
|
|
1705
|
+
}
|
|
1706
|
+
if (closingTab && modeForTab(closingTab) === "preview" && activePreviewTabId === id) {
|
|
1707
|
+
activePreviewTabId = findFallbackTabId(tabs, "preview", closingIndex);
|
|
1621
1708
|
}
|
|
1622
|
-
|
|
1709
|
+
if (activeMode === "work" && !activeWorkTabId && activePreviewTabId) {
|
|
1710
|
+
activeMode = "preview";
|
|
1711
|
+
}
|
|
1712
|
+
if (activeMode === "preview" && !activePreviewTabId && activeWorkTabId) {
|
|
1713
|
+
activeMode = "work";
|
|
1714
|
+
}
|
|
1715
|
+
return {
|
|
1716
|
+
tabs,
|
|
1717
|
+
activeMode,
|
|
1718
|
+
activeWorkTabId,
|
|
1719
|
+
activePreviewTabId,
|
|
1720
|
+
activeTabId: activeMode === "preview" ? activePreviewTabId : activeWorkTabId
|
|
1721
|
+
};
|
|
1623
1722
|
}),
|
|
1624
1723
|
updateSessionFileOperationIndex: (id, index) => set((state) => ({
|
|
1625
1724
|
tabs: state.tabs.map((tab) => tab.id === id && tab.type === "session-file-diff" ? { ...tab, selectedOperationIndex: index } : tab)
|
|
1626
1725
|
})),
|
|
1627
|
-
closeAllTabs: () => set({
|
|
1726
|
+
closeAllTabs: () => set({
|
|
1727
|
+
tabs: [],
|
|
1728
|
+
activeTabId: null,
|
|
1729
|
+
activeMode: "work",
|
|
1730
|
+
activeWorkTabId: null,
|
|
1731
|
+
activePreviewTabId: null
|
|
1732
|
+
})
|
|
1628
1733
|
}));
|
|
1629
1734
|
|
|
1630
1735
|
// src/stores/skillsStore.ts
|
|
@@ -2674,6 +2779,7 @@ function useSessionStream(sessionId, enabled = true) {
|
|
|
2674
2779
|
return typeof payload?.toolName === "string" ? payload.toolName : null;
|
|
2675
2780
|
};
|
|
2676
2781
|
const getToolEventArgs = (payload) => payload?.args ?? payload?.input;
|
|
2782
|
+
const getToolEventResult = (payload) => payload?.result ?? payload?.output;
|
|
2677
2783
|
const getToolBufferKey = (payload) => {
|
|
2678
2784
|
const callId = getToolEventCallId(payload);
|
|
2679
2785
|
if (callId)
|
|
@@ -3114,6 +3220,30 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
3114
3220
|
});
|
|
3115
3221
|
}
|
|
3116
3222
|
};
|
|
3223
|
+
const handleSimulatorToolActivity = (eventType, payload) => {
|
|
3224
|
+
if (eventType !== "tool.result")
|
|
3225
|
+
return;
|
|
3226
|
+
const result = getToolEventResult(payload);
|
|
3227
|
+
if (!result || typeof result !== "object" || Array.isArray(result))
|
|
3228
|
+
return;
|
|
3229
|
+
const resultRecord = result;
|
|
3230
|
+
const firstStream = Array.isArray(resultRecord.streams) ? resultRecord.streams[0] : undefined;
|
|
3231
|
+
const stream = resultRecord.stream ?? firstStream;
|
|
3232
|
+
const previewUrl = resultRecord.previewUrl;
|
|
3233
|
+
if (typeof previewUrl === "string" && previewUrl.trim()) {
|
|
3234
|
+
useViewerTabsStore.getState().openBrowserTab(previewUrl, {
|
|
3235
|
+
kind: "simulator",
|
|
3236
|
+
title: "Simulator"
|
|
3237
|
+
});
|
|
3238
|
+
return;
|
|
3239
|
+
}
|
|
3240
|
+
if (!stream || typeof stream !== "object" || Array.isArray(stream))
|
|
3241
|
+
return;
|
|
3242
|
+
useViewerTabsStore.getState().openBrowserTab("http://localhost:3200", {
|
|
3243
|
+
kind: "simulator",
|
|
3244
|
+
title: "Simulator"
|
|
3245
|
+
});
|
|
3246
|
+
};
|
|
3117
3247
|
const handleToolActivityViewerEvent = (eventType, payload, delta) => {
|
|
3118
3248
|
const name = getToolEventName(payload);
|
|
3119
3249
|
if (name === "read")
|
|
@@ -3123,6 +3253,9 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
|
|
|
3123
3253
|
if (name === "apply_patch") {
|
|
3124
3254
|
handleApplyPatchToolActivity(eventType, payload, delta);
|
|
3125
3255
|
}
|
|
3256
|
+
if (name === "simulator") {
|
|
3257
|
+
handleSimulatorToolActivity(eventType, payload);
|
|
3258
|
+
}
|
|
3126
3259
|
};
|
|
3127
3260
|
const getToolInputDelta = (payload) => {
|
|
3128
3261
|
if (typeof payload?.delta === "string")
|
|
@@ -6864,4 +6997,4 @@ export {
|
|
|
6864
6997
|
normalizeQueueState
|
|
6865
6998
|
};
|
|
6866
6999
|
|
|
6867
|
-
//# debugId=
|
|
7000
|
+
//# debugId=C8B7C4D04F69D1E164756E2164756E21
|