pinokiod 6.0.92 → 6.0.96
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/package.json +1 -1
- package/server/index.js +36 -0
- package/server/views/terminals.ejs +45 -3
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -6740,6 +6740,38 @@ class Server {
|
|
|
6740
6740
|
}
|
|
6741
6741
|
return num
|
|
6742
6742
|
}
|
|
6743
|
+
const normalizeWorkspaceChatCount = (value) => {
|
|
6744
|
+
const parsed = Number.parseInt(value, 10)
|
|
6745
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
6746
|
+
return null
|
|
6747
|
+
}
|
|
6748
|
+
return parsed
|
|
6749
|
+
}
|
|
6750
|
+
const readWorkspaceChatCount = async (workspacePath) => {
|
|
6751
|
+
if (typeof workspacePath !== "string" || workspacePath.trim().length === 0) {
|
|
6752
|
+
return null
|
|
6753
|
+
}
|
|
6754
|
+
const metadataPath = path.resolve(workspacePath, ".pinokio-terminal.json")
|
|
6755
|
+
try {
|
|
6756
|
+
const raw = await fs.promises.readFile(metadataPath, "utf8")
|
|
6757
|
+
const parsed = JSON.parse(raw)
|
|
6758
|
+
const explicitCount = normalizeWorkspaceChatCount(
|
|
6759
|
+
parsed && Object.prototype.hasOwnProperty.call(parsed, "chat_count")
|
|
6760
|
+
? parsed.chat_count
|
|
6761
|
+
: (parsed && Object.prototype.hasOwnProperty.call(parsed, "chatCount")
|
|
6762
|
+
? parsed.chatCount
|
|
6763
|
+
: "")
|
|
6764
|
+
)
|
|
6765
|
+
if (explicitCount !== null) {
|
|
6766
|
+
return explicitCount
|
|
6767
|
+
}
|
|
6768
|
+
if (parsed && Array.isArray(parsed.sessions)) {
|
|
6769
|
+
return parsed.sessions.length
|
|
6770
|
+
}
|
|
6771
|
+
} catch (_) {
|
|
6772
|
+
}
|
|
6773
|
+
return null
|
|
6774
|
+
}
|
|
6743
6775
|
const managedWorkspacesRoot = path.resolve(getTerminalWorkspacesRoot())
|
|
6744
6776
|
const managedWorkspaceFolderKeys = new Set(
|
|
6745
6777
|
rootWorkspaces
|
|
@@ -6823,6 +6855,10 @@ class Server {
|
|
|
6823
6855
|
if (currentUpdatedAt === null && normalizedUpdatedAt !== null) {
|
|
6824
6856
|
workspace.updated_at = normalizedUpdatedAt
|
|
6825
6857
|
}
|
|
6858
|
+
const chatCount = await readWorkspaceChatCount(workspace.cwd)
|
|
6859
|
+
if (chatCount !== null) {
|
|
6860
|
+
workspace.chat_count = chatCount
|
|
6861
|
+
}
|
|
6826
6862
|
}))
|
|
6827
6863
|
const workspaces = workspaceEntries
|
|
6828
6864
|
.sort((a, b) => {
|
|
@@ -2168,6 +2168,9 @@ body.dark .terminals-list .line.active {
|
|
|
2168
2168
|
.terminals-list .line .terminals-workspace-session-count-badge {
|
|
2169
2169
|
min-width: 18px;
|
|
2170
2170
|
height: 18px;
|
|
2171
|
+
display: inline-flex;
|
|
2172
|
+
align-items: center;
|
|
2173
|
+
justify-content: center;
|
|
2171
2174
|
border-radius: 999px;
|
|
2172
2175
|
background: rgba(37, 99, 235, 0.18);
|
|
2173
2176
|
color: #1d4ed8;
|
|
@@ -2175,6 +2178,7 @@ body.dark .terminals-list .line.active {
|
|
|
2175
2178
|
font-weight: 700;
|
|
2176
2179
|
line-height: 18px;
|
|
2177
2180
|
text-align: center;
|
|
2181
|
+
white-space: nowrap;
|
|
2178
2182
|
padding: 0 6px;
|
|
2179
2183
|
flex-shrink: 0;
|
|
2180
2184
|
box-sizing: border-box;
|
|
@@ -5277,6 +5281,30 @@ body.dark .swal2-popup.pinokio-diff-modal .pinokio-modal-footer--commit .pinokio
|
|
|
5277
5281
|
const bn = (b && b.name ? String(b.name) : "").toLowerCase()
|
|
5278
5282
|
return an.localeCompare(bn)
|
|
5279
5283
|
}
|
|
5284
|
+
const normalizeWorkspaceChatCount = (value) => {
|
|
5285
|
+
const parsed = Number.parseInt(value, 10)
|
|
5286
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
5287
|
+
return null
|
|
5288
|
+
}
|
|
5289
|
+
return parsed
|
|
5290
|
+
}
|
|
5291
|
+
const getWorkspaceChatCount = (workspace) => {
|
|
5292
|
+
const explicitCount = normalizeWorkspaceChatCount(
|
|
5293
|
+
workspace && Object.prototype.hasOwnProperty.call(workspace, "chatCount")
|
|
5294
|
+
? workspace.chatCount
|
|
5295
|
+
: (workspace && Object.prototype.hasOwnProperty.call(workspace, "chat_count")
|
|
5296
|
+
? workspace.chat_count
|
|
5297
|
+
: "")
|
|
5298
|
+
)
|
|
5299
|
+
if (explicitCount !== null) {
|
|
5300
|
+
return explicitCount
|
|
5301
|
+
}
|
|
5302
|
+
return workspace && Array.isArray(workspace.sessions) ? workspace.sessions.length : 0
|
|
5303
|
+
}
|
|
5304
|
+
const formatWorkspaceChatCount = (workspace) => {
|
|
5305
|
+
const count = getWorkspaceChatCount(workspace)
|
|
5306
|
+
return `${count} ${count === 1 ? "chat" : "chats"}`
|
|
5307
|
+
}
|
|
5280
5308
|
const getWorkspacePathFromSession = (session) => {
|
|
5281
5309
|
if (!session || typeof session !== "object") {
|
|
5282
5310
|
return ""
|
|
@@ -5360,6 +5388,13 @@ body.dark .swal2-popup.pinokio-diff-modal .pinokio-modal-footer--commit .pinokio
|
|
|
5360
5388
|
key,
|
|
5361
5389
|
cwd,
|
|
5362
5390
|
name: fallback && fallback.name ? fallback.name : getWorkspaceNameFromPath(cwd),
|
|
5391
|
+
chatCount: normalizeWorkspaceChatCount(
|
|
5392
|
+
fallback && Object.prototype.hasOwnProperty.call(fallback, "chatCount")
|
|
5393
|
+
? fallback.chatCount
|
|
5394
|
+
: (fallback && Object.prototype.hasOwnProperty.call(fallback, "chat_count")
|
|
5395
|
+
? fallback.chat_count
|
|
5396
|
+
: "")
|
|
5397
|
+
),
|
|
5363
5398
|
sessions: [],
|
|
5364
5399
|
updatedAt: parseTimestamp(fallback && Object.prototype.hasOwnProperty.call(fallback, "updatedAt") ? fallback.updatedAt : (fallback && fallback.updated_at ? fallback.updated_at : null)),
|
|
5365
5400
|
timestamp: null,
|
|
@@ -8462,6 +8497,13 @@ body.dark .swal2-popup.pinokio-diff-modal .pinokio-modal-footer--commit .pinokio
|
|
|
8462
8497
|
.map((workspace) => ({
|
|
8463
8498
|
name: workspace && workspace.name ? String(workspace.name) : "",
|
|
8464
8499
|
cwd: workspace && workspace.cwd ? String(workspace.cwd) : "",
|
|
8500
|
+
chatCount: normalizeWorkspaceChatCount(
|
|
8501
|
+
workspace && Object.prototype.hasOwnProperty.call(workspace, "chatCount")
|
|
8502
|
+
? workspace.chatCount
|
|
8503
|
+
: (workspace && Object.prototype.hasOwnProperty.call(workspace, "chat_count")
|
|
8504
|
+
? workspace.chat_count
|
|
8505
|
+
: "")
|
|
8506
|
+
),
|
|
8465
8507
|
updatedAt: parseTimestamp(workspace && (workspace.updated_at || workspace.updatedAt) ? (workspace.updated_at || workspace.updatedAt) : null),
|
|
8466
8508
|
managed: parseBooleanFlag(
|
|
8467
8509
|
workspace && Object.prototype.hasOwnProperty.call(workspace, "managed")
|
|
@@ -8876,11 +8918,11 @@ body.dark .swal2-popup.pinokio-diff-modal .pinokio-modal-footer--commit .pinokio
|
|
|
8876
8918
|
titleText.innerHTML = highlightMatches(workspace.name, query)
|
|
8877
8919
|
titleLeft.appendChild(titleText)
|
|
8878
8920
|
title.appendChild(titleLeft)
|
|
8879
|
-
const
|
|
8921
|
+
const countLabel = formatWorkspaceChatCount(workspace)
|
|
8880
8922
|
const countBadge = document.createElement("span")
|
|
8881
8923
|
countBadge.className = "terminals-workspace-session-count-badge"
|
|
8882
|
-
countBadge.textContent =
|
|
8883
|
-
countBadge.setAttribute("aria-label",
|
|
8924
|
+
countBadge.textContent = countLabel
|
|
8925
|
+
countBadge.setAttribute("aria-label", countLabel)
|
|
8884
8926
|
title.appendChild(countBadge)
|
|
8885
8927
|
const updatedAtLabel = formatTimeAgo(workspace && workspace.updatedAt ? workspace.updatedAt : null)
|
|
8886
8928
|
const metaRow = document.createElement("div")
|