@ycodium-ai/plugin-session-import 0.2.2106 → 0.2.2126
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/index.js +57 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1419,6 +1419,19 @@ async function withCodex(ctx, instance, use) {
|
|
|
1419
1419
|
await client.close();
|
|
1420
1420
|
}
|
|
1421
1421
|
}
|
|
1422
|
+
async function nativeSessionsOf(ctx, instanceId) {
|
|
1423
|
+
const resolve = ctx.providers.nativeSessions;
|
|
1424
|
+
if (typeof resolve !== "function") return null;
|
|
1425
|
+
try {
|
|
1426
|
+
return await resolve(instanceId);
|
|
1427
|
+
} catch (error) {
|
|
1428
|
+
ctx.log.warn("session-import could not reach the executor's own session scan", {
|
|
1429
|
+
instanceId,
|
|
1430
|
+
detail: describeError(error)
|
|
1431
|
+
});
|
|
1432
|
+
return null;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1422
1435
|
async function listSessions(ctx, input) {
|
|
1423
1436
|
const project = await ctx.projections.getProject(input.projectId);
|
|
1424
1437
|
if (project === null) {
|
|
@@ -1432,6 +1445,50 @@ async function listSessions(ctx, input) {
|
|
|
1432
1445
|
const scannedKeys = /* @__PURE__ */ new Set();
|
|
1433
1446
|
for (const instance of instances) {
|
|
1434
1447
|
if (!instance.enabled) continue;
|
|
1448
|
+
const provider = providerKindOfDriver(instance.driver);
|
|
1449
|
+
if (provider === void 0) continue;
|
|
1450
|
+
const hand = await nativeSessionsOf(ctx, instance.instanceId);
|
|
1451
|
+
if (hand !== null) {
|
|
1452
|
+
const scanKey2 = `hand:${instance.driver}:${instance.homePath ?? instance.instanceId}`;
|
|
1453
|
+
if (scannedKeys.has(scanKey2)) continue;
|
|
1454
|
+
scannedKeys.add(scanKey2);
|
|
1455
|
+
try {
|
|
1456
|
+
const scanned = await hand.scan({ projectId: input.projectId, directory });
|
|
1457
|
+
sources.push({
|
|
1458
|
+
instanceId: instance.instanceId,
|
|
1459
|
+
provider,
|
|
1460
|
+
candidates: scanned.candidates.map(
|
|
1461
|
+
(row) => candidateOf({
|
|
1462
|
+
provider,
|
|
1463
|
+
instanceId: instance.instanceId,
|
|
1464
|
+
nativeSessionId: row.nativeSessionId,
|
|
1465
|
+
cwd: row.cwd,
|
|
1466
|
+
title: row.title,
|
|
1467
|
+
preview: row.preview,
|
|
1468
|
+
model: row.model,
|
|
1469
|
+
turnCount: row.turnCount,
|
|
1470
|
+
updatedAt: row.updatedAt,
|
|
1471
|
+
openElsewhere: row.openElsewhere,
|
|
1472
|
+
// 「已经有 thread 绑着它」是宿主的账,手报不出来,一律盖上去。
|
|
1473
|
+
importedThreadId: imported.get(importedThreadKey(provider, row.nativeSessionId))
|
|
1474
|
+
})
|
|
1475
|
+
),
|
|
1476
|
+
unavailableReason: null
|
|
1477
|
+
});
|
|
1478
|
+
} catch (error) {
|
|
1479
|
+
ctx.log.warn("session-import could not read sessions from the executor", {
|
|
1480
|
+
instanceId: instance.instanceId,
|
|
1481
|
+
detail: describeError(error)
|
|
1482
|
+
});
|
|
1483
|
+
sources.push({
|
|
1484
|
+
instanceId: instance.instanceId,
|
|
1485
|
+
provider,
|
|
1486
|
+
candidates: [],
|
|
1487
|
+
unavailableReason: provider === "codex" ? "Codex sessions could not be read." : "Claude sessions could not be read."
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
continue;
|
|
1491
|
+
}
|
|
1435
1492
|
if (instance.driver === CODEX_DRIVER) {
|
|
1436
1493
|
const binaryPath = ctx.config.codexBinaries?.[instance.instanceId];
|
|
1437
1494
|
if (binaryPath === void 0) continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/plugin-session-import",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2126",
|
|
4
4
|
"description": "Brings a session you started in a terminal into Ycodium.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"session-import",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"effect": "4.0.0-beta.103",
|
|
21
21
|
"esbuild": "0.28.1",
|
|
22
22
|
"vite-plus": "0.2.2",
|
|
23
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
23
|
+
"@ycodium-ai/plugin-api": "0.2.2126"
|
|
24
24
|
},
|
|
25
25
|
"ycodium": {
|
|
26
26
|
"plugin": "./dist/index.js",
|