@ycodium-ai/plugin-session-import 0.2.3130 → 0.2.3168
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 +3 -2
- package/dist/index.js +19 -18
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -25,8 +25,9 @@ A Ycodium server. The plugin asks to:
|
|
|
25
25
|
|
|
26
26
|
- read every provider instance's home, transcript, and config directories
|
|
27
27
|
- spawn Codex binaries the host names
|
|
28
|
-
-
|
|
29
|
-
|
|
28
|
+
- import and append history through `ctx.threads.import` and
|
|
29
|
+
`ctx.threads.externalMessages.append`, declaring `thread.import` and
|
|
30
|
+
`thread.external-messages.append` in `commands.dispatch`
|
|
30
31
|
- declare `thread.session.stop` and `threads.user` to stop idle project sessions on this machine after syncing external history
|
|
31
32
|
|
|
32
33
|
Sync requests a stop through `ctx.threads.session.stop` with `onlyIfNoTurnInFlight: true` and a fresh request id each time.
|
package/dist/index.js
CHANGED
|
@@ -1715,7 +1715,7 @@ async function listSessions(ctx, input) {
|
|
|
1715
1715
|
}
|
|
1716
1716
|
const directory = input.directory ?? project.workspaceRoot;
|
|
1717
1717
|
const caseInsensitive = caseInsensitivePaths();
|
|
1718
|
-
const instances = await ctx.providers.
|
|
1718
|
+
const instances = await ctx.providers.instances.list({});
|
|
1719
1719
|
const imported = await readImportedThreads(ctx);
|
|
1720
1720
|
const sources = [];
|
|
1721
1721
|
const scannedKeys = /* @__PURE__ */ new Set();
|
|
@@ -2371,7 +2371,7 @@ async function runImportOnce(ctx, input, emit) {
|
|
|
2371
2371
|
emit({ kind: "import_started", threadId: input.threadId, phases: ["read", "create", "link"] });
|
|
2372
2372
|
const project = await projectOrNull2(ctx.projects, input.projectId);
|
|
2373
2373
|
if (project === null) return fail("Project not found.", "notFound");
|
|
2374
|
-
const instances = await ctx.providers.
|
|
2374
|
+
const instances = await ctx.providers.instances.list({});
|
|
2375
2375
|
const instance = instances.find((row) => row.instanceId === input.instanceId);
|
|
2376
2376
|
if (instance === void 0 || !instance.enabled) {
|
|
2377
2377
|
return fail(`This ${input.provider} provider instance is not enabled.`);
|
|
@@ -2463,21 +2463,24 @@ async function runImportOnce(ctx, input, emit) {
|
|
|
2463
2463
|
if (existing === null && batches.length === 0) batches.push({ messages: [], activities: [] });
|
|
2464
2464
|
try {
|
|
2465
2465
|
for (const batch of batches) {
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2466
|
+
const historyInput = {
|
|
2467
|
+
requestId: historyCommandId(input.threadId, batch),
|
|
2468
|
+
threadId: input.threadId,
|
|
2469
|
+
...batch
|
|
2470
|
+
};
|
|
2471
|
+
if (threadCreated) {
|
|
2472
|
+
await ctx.threads.externalMessages.append(historyInput);
|
|
2473
|
+
} else {
|
|
2474
|
+
await ctx.threads.import({
|
|
2475
|
+
...historyInput,
|
|
2469
2476
|
projectId: input.projectId,
|
|
2470
2477
|
title: resolveImportedTitle(transcript),
|
|
2471
2478
|
modelSelection,
|
|
2472
2479
|
runtimeMode: "full-access",
|
|
2473
2480
|
branch: null,
|
|
2474
2481
|
worktreePath: null
|
|
2475
|
-
}
|
|
2476
|
-
|
|
2477
|
-
threadId: input.threadId,
|
|
2478
|
-
...batch,
|
|
2479
|
-
createdAt: now
|
|
2480
|
-
});
|
|
2482
|
+
});
|
|
2483
|
+
}
|
|
2481
2484
|
threadCreated = true;
|
|
2482
2485
|
}
|
|
2483
2486
|
} catch (error) {
|
|
@@ -2580,7 +2583,7 @@ var NativeSessionTail = class {
|
|
|
2580
2583
|
if (binding === void 0 || binding.instanceId === null) return NOT_IMPORTED;
|
|
2581
2584
|
const nativeSessionId = nativeSessionIdOf("claude", binding.resumeCursor);
|
|
2582
2585
|
if (nativeSessionId === null) return NOT_IMPORTED;
|
|
2583
|
-
const instance = (await this.ctx.providers.
|
|
2586
|
+
const instance = (await this.ctx.providers.instances.list({})).find(
|
|
2584
2587
|
(row) => row.instanceId === binding.instanceId
|
|
2585
2588
|
);
|
|
2586
2589
|
const transcriptDir = instance?.transcriptDir ?? null;
|
|
@@ -2630,12 +2633,10 @@ var NativeSessionTail = class {
|
|
|
2630
2633
|
}
|
|
2631
2634
|
try {
|
|
2632
2635
|
for (const batch of batches) {
|
|
2633
|
-
await this.ctx.
|
|
2634
|
-
|
|
2635
|
-
commandId: historyCommandId(threadId, batch),
|
|
2636
|
+
await this.ctx.threads.externalMessages.append({
|
|
2637
|
+
requestId: historyCommandId(threadId, batch),
|
|
2636
2638
|
threadId,
|
|
2637
|
-
...batch
|
|
2638
|
-
createdAt: appendedAt
|
|
2639
|
+
...batch
|
|
2639
2640
|
});
|
|
2640
2641
|
}
|
|
2641
2642
|
} catch (error) {
|
|
@@ -2674,7 +2675,7 @@ var NativeSessionTail = class {
|
|
|
2674
2675
|
// src/index.ts
|
|
2675
2676
|
var index_default = definePlugin({
|
|
2676
2677
|
id: "session-import",
|
|
2677
|
-
apiVersion:
|
|
2678
|
+
apiVersion: 16,
|
|
2678
2679
|
activate: (ctx) => {
|
|
2679
2680
|
ctx.command({
|
|
2680
2681
|
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.3168",
|
|
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.3168",
|
|
24
|
+
"ycodium-jsonl-stream": "0.0.0"
|
|
25
25
|
},
|
|
26
26
|
"ycodium": {
|
|
27
27
|
"plugin": "./dist/index.js",
|