@ycodium-ai/plugin-session-import 0.2.3192 → 0.2.3208
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 +23 -6
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -165,6 +165,20 @@ var sessionImportSyncResultSchema = {
|
|
|
165
165
|
|
|
166
166
|
// src/sessionImportRuntime.ts
|
|
167
167
|
import * as NodeCrypto4 from "node:crypto";
|
|
168
|
+
|
|
169
|
+
// src/providerSessions.ts
|
|
170
|
+
async function listAllProviderSessions(port) {
|
|
171
|
+
const sessions = [];
|
|
172
|
+
let cursor;
|
|
173
|
+
do {
|
|
174
|
+
const page = await port.list(cursor === void 0 ? {} : { cursor });
|
|
175
|
+
sessions.push(...page.sessions);
|
|
176
|
+
cursor = page.nextCursor ?? void 0;
|
|
177
|
+
} while (cursor !== void 0);
|
|
178
|
+
return sessions;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// src/sessionImportRuntime.ts
|
|
168
182
|
import {
|
|
169
183
|
projectOrNull as projectOrNull2,
|
|
170
184
|
threadOrNull as threadOrNull2
|
|
@@ -1649,7 +1663,7 @@ var nativeSessionIdOf = (provider, cursor) => {
|
|
|
1649
1663
|
};
|
|
1650
1664
|
async function readImportedThreads(ctx) {
|
|
1651
1665
|
const imported = /* @__PURE__ */ new Map();
|
|
1652
|
-
const bindings = await ctx.providers.sessions
|
|
1666
|
+
const bindings = await listAllProviderSessions(ctx.providers.sessions).catch(() => []);
|
|
1653
1667
|
for (const binding of bindings) {
|
|
1654
1668
|
const provider = providerKindOfDriver(binding.driver);
|
|
1655
1669
|
if (provider === void 0) continue;
|
|
@@ -2379,7 +2393,10 @@ async function runImportOnce(ctx, input, emit) {
|
|
|
2379
2393
|
if (providerKindOfDriver(instance.driver) !== input.provider) {
|
|
2380
2394
|
return fail("The selected provider does not own this native session.");
|
|
2381
2395
|
}
|
|
2382
|
-
const bindings = await ctx.providers.sessions.list(
|
|
2396
|
+
const { sessions: bindings } = await ctx.providers.sessions.list({
|
|
2397
|
+
threadId: input.threadId,
|
|
2398
|
+
limit: 1
|
|
2399
|
+
});
|
|
2383
2400
|
const existing = await readExistingThread(ctx.threads, input.threadId).catch((error) => {
|
|
2384
2401
|
if (error instanceof TimelineKeptChangingError) return fail(EXISTING_THREAD_NOT_IDLE);
|
|
2385
2402
|
throw error;
|
|
@@ -2401,7 +2418,7 @@ async function runImportOnce(ctx, input, emit) {
|
|
|
2401
2418
|
return fail(EXISTING_THREAD_NOT_IDLE);
|
|
2402
2419
|
threadCreated = true;
|
|
2403
2420
|
} else {
|
|
2404
|
-
for (const candidate2 of
|
|
2421
|
+
for (const candidate2 of await listAllProviderSessions(ctx.providers.sessions)) {
|
|
2405
2422
|
if (providerKindOfDriver(candidate2.driver) !== input.provider || nativeSessionIdOf(input.provider, candidate2.resumeCursor) !== input.nativeSessionId)
|
|
2406
2423
|
continue;
|
|
2407
2424
|
const imported = await threadOrNull2(ctx.threads, candidate2.threadId);
|
|
@@ -2577,10 +2594,10 @@ var NativeSessionTail = class {
|
|
|
2577
2594
|
});
|
|
2578
2595
|
}
|
|
2579
2596
|
async syncOnce(threadId) {
|
|
2580
|
-
const binding = (await this.ctx.providers.sessions.list()).find(
|
|
2597
|
+
const binding = (await this.ctx.providers.sessions.list({ threadId, limit: 1 })).sessions.find(
|
|
2581
2598
|
(candidate2) => candidate2.threadId === threadId && providerKindOfDriver(candidate2.driver) === "claude"
|
|
2582
2599
|
);
|
|
2583
|
-
if (binding === void 0
|
|
2600
|
+
if (binding === void 0) return NOT_IMPORTED;
|
|
2584
2601
|
const nativeSessionId = nativeSessionIdOf("claude", binding.resumeCursor);
|
|
2585
2602
|
if (nativeSessionId === null) return NOT_IMPORTED;
|
|
2586
2603
|
const instance = (await this.ctx.providers.instances.list({})).find(
|
|
@@ -2675,7 +2692,7 @@ var NativeSessionTail = class {
|
|
|
2675
2692
|
// src/index.ts
|
|
2676
2693
|
var index_default = definePlugin({
|
|
2677
2694
|
id: "session-import",
|
|
2678
|
-
apiVersion:
|
|
2695
|
+
apiVersion: 19,
|
|
2679
2696
|
activate: (ctx) => {
|
|
2680
2697
|
ctx.command({
|
|
2681
2698
|
name: "scan",
|
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.3208",
|
|
4
4
|
"description": "Brings a session you started in a terminal into Ycodium.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"session-import",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"effect": "4.0.0-beta.103",
|
|
21
21
|
"esbuild": "0.28.1",
|
|
22
22
|
"vite-plus": "0.2.2",
|
|
23
|
-
"ycodium-
|
|
24
|
-
"
|
|
23
|
+
"@ycodium-ai/plugin-api": "0.2.3208",
|
|
24
|
+
"ycodium-jsonl-stream": "0.0.0"
|
|
25
25
|
},
|
|
26
26
|
"ycodium": {
|
|
27
27
|
"plugin": "./dist/index.js",
|