@narumitw/pi-sync 0.70.5 → 0.70.7
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/CHANGELOG.md +12 -0
- package/README.md +2 -0
- package/dist/chunks/{chunk-3XN4FR72.ts → chunk-4A34OGXY.ts} +9 -9
- package/dist/chunks/{chunk-7NQ7SFZK.ts → chunk-5BE6LBDC.ts} +15 -15
- package/dist/chunks/chunk-A43CJYG4.ts +26 -0
- package/dist/chunks/chunk-A43CJYG4.ts.map +7 -0
- package/dist/chunks/{chunk-JPTI4HFC.ts → chunk-AXN3B5KC.ts} +22 -22
- package/dist/chunks/{chunk-SPXEDJ2G.ts → chunk-HCXPNKPU.ts} +61 -59
- package/dist/chunks/chunk-HCXPNKPU.ts.map +7 -0
- package/dist/chunks/{chunk-N24HEZSA.ts → chunk-VERMBZGL.ts} +7 -7
- package/dist/chunks/{chunk-LSIUAXE4.ts → chunk-WE3KJ7JS.ts} +8 -8
- package/dist/chunks/{chunk-5T4ZOHYF.ts → chunk-WRS3SUNZ.ts} +4 -18
- package/dist/chunks/chunk-WRS3SUNZ.ts.map +7 -0
- package/dist/chunks/client-debug-F4WFP2YJ.ts +40 -0
- package/dist/chunks/client-debug-F4WFP2YJ.ts.map +7 -0
- package/dist/chunks/{command-handler-PT2KVTLD.ts → command-handler-DWWFIXSC.ts} +34 -32
- package/dist/chunks/{command-handler-PT2KVTLD.ts.map → command-handler-DWWFIXSC.ts.map} +1 -1
- package/dist/chunks/{conflict-review-QI77P7KL.ts → conflict-review-HSERM245.ts} +3 -3
- package/dist/chunks/debug-tool-execution-7N4H6K3X.ts +67 -0
- package/dist/chunks/debug-tool-execution-7N4H6K3X.ts.map +7 -0
- package/dist/chunks/{diff-review-SOLP33TQ.ts → diff-review-6IUIOYST.ts} +3 -3
- package/dist/chunks/{diff-review-ILRZDQ4S.ts → diff-review-GB4NO53B.ts} +4 -4
- package/dist/chunks/{file-selection-2H3J2HTX.ts → file-selection-DGC5UJVI.ts} +9 -9
- package/dist/chunks/{manager-result-dispatcher-75FS46JP.ts → manager-result-dispatcher-6MOJPLIS.ts} +7 -7
- package/dist/chunks/{manager-ui-HW3ZAEVK.ts → manager-ui-3CQU37XY.ts} +52 -50
- package/dist/chunks/{manager-ui-HW3ZAEVK.ts.map → manager-ui-3CQU37XY.ts.map} +1 -1
- package/dist/chunks/{remote-selection-ui-AE6FOEXH.ts → remote-selection-ui-2V53UBHM.ts} +6 -6
- package/dist/chunks/{setup-switch-LJPEZONY.ts → setup-switch-WSKVGW7L.ts} +4 -4
- package/dist/chunks/{setup-wizard-FBX7RTZ6.ts → setup-wizard-FRIR2EOR.ts} +9 -9
- package/dist/chunks/{sync-inspection-TZ4EMSBN.ts → sync-inspection-CQDNC542.ts} +6 -6
- package/dist/chunks/{sync-operations-QIQ3G66S.ts → sync-operations-IF7LMWK6.ts} +4 -4
- package/dist/chunks/sync-state-store-TZE7XDV5.ts +23 -0
- package/dist/chunks/sync-state-store-TZE7XDV5.ts.map +7 -0
- package/dist/daemon/dist/build-id.json +1 -1
- package/dist/daemon/dist/cli.js +3 -2
- package/dist/daemon/dist/client.js +55 -14
- package/dist/daemon/dist/daemon-startup.js +2 -14
- package/dist/daemon/dist/daemon-upgrade-error.js +14 -0
- package/dist/daemon/dist/index.js +20 -3
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +278 -248
- package/dist/index.ts.map +2 -2
- package/docs/daemon-migration.md +2 -0
- package/package.json +2 -2
- package/src/daemon/client-debug.ts +2 -0
- package/src/daemon/pi-client.ts +60 -22
- package/src/sync/automatic-sync.ts +5 -3
- package/src/sync/debug-tool-execution.ts +66 -0
- package/src/sync/debug-tool.ts +8 -56
- package/src/sync/startup-check.ts +3 -1
- package/src/sync-extension.ts +252 -166
- package/dist/chunks/chunk-5T4ZOHYF.ts.map +0 -7
- package/dist/chunks/chunk-SPXEDJ2G.ts.map +0 -7
- /package/dist/chunks/{chunk-3XN4FR72.ts.map → chunk-4A34OGXY.ts.map} +0 -0
- /package/dist/chunks/{chunk-7NQ7SFZK.ts.map → chunk-5BE6LBDC.ts.map} +0 -0
- /package/dist/chunks/{chunk-JPTI4HFC.ts.map → chunk-AXN3B5KC.ts.map} +0 -0
- /package/dist/chunks/{chunk-N24HEZSA.ts.map → chunk-VERMBZGL.ts.map} +0 -0
- /package/dist/chunks/{chunk-LSIUAXE4.ts.map → chunk-WE3KJ7JS.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-QI77P7KL.ts.map → conflict-review-HSERM245.ts.map} +0 -0
- /package/dist/chunks/{diff-review-SOLP33TQ.ts.map → diff-review-6IUIOYST.ts.map} +0 -0
- /package/dist/chunks/{diff-review-ILRZDQ4S.ts.map → diff-review-GB4NO53B.ts.map} +0 -0
- /package/dist/chunks/{file-selection-2H3J2HTX.ts.map → file-selection-DGC5UJVI.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-75FS46JP.ts.map → manager-result-dispatcher-6MOJPLIS.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-AE6FOEXH.ts.map → remote-selection-ui-2V53UBHM.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-LJPEZONY.ts.map → setup-switch-WSKVGW7L.ts.map} +0 -0
- /package/dist/chunks/{setup-wizard-FBX7RTZ6.ts.map → setup-wizard-FRIR2EOR.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-TZ4EMSBN.ts.map → sync-inspection-CQDNC542.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-QIQ3G66S.ts.map → sync-operations-IF7LMWK6.ts.map} +0 -0
package/src/sync-extension.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { completeSyncArguments, retiredSyncCommandGuidance, splitArgs } from "./
|
|
|
3
3
|
import {
|
|
4
4
|
bindPiDaemonClient,
|
|
5
5
|
installPiDaemonHost,
|
|
6
|
+
PI_SYNC_BINDING_UNAVAILABLE,
|
|
6
7
|
type PiDaemonClient,
|
|
7
8
|
withPiDaemonClient,
|
|
8
9
|
} from "./daemon/pi-client.js";
|
|
@@ -20,46 +21,57 @@ import { createSyncAttentionController } from "./ui/sync-attention.js";
|
|
|
20
21
|
import { createSyncStatusPublisher } from "./ui/sync-status.js";
|
|
21
22
|
import { safeTerminalText } from "./ui/terminal-text.js";
|
|
22
23
|
|
|
24
|
+
type SyncSession = {
|
|
25
|
+
client: PiDaemonClient;
|
|
26
|
+
abort: AbortController;
|
|
27
|
+
check: ReturnType<typeof createStartupCheck>;
|
|
28
|
+
presence?: ReturnType<typeof sessionPresence>;
|
|
29
|
+
releaseStatus: () => void;
|
|
30
|
+
initialization: Promise<AnySyncConfig | false | undefined>;
|
|
31
|
+
shutdown?: { abort?: AbortController; done: Promise<void> };
|
|
32
|
+
};
|
|
33
|
+
|
|
23
34
|
export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDependencies> = {}) {
|
|
24
35
|
installPiDaemonHost();
|
|
25
36
|
const loaders = createSyncLoaders(dependencies);
|
|
26
37
|
const attention = createSyncAttentionController();
|
|
27
38
|
const status = createSyncStatusPublisher(pi.events);
|
|
28
39
|
const publishTimings = registerStartupTimings(pi);
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
owner?.debugEnabled && !sessionAbort.signal.aborted && ownerManager === ctx.sessionManager
|
|
38
|
-
? { client: owner, signal: sessionAbort.signal }
|
|
39
|
-
: undefined,
|
|
40
|
-
);
|
|
40
|
+
const beforeStart = new AbortController();
|
|
41
|
+
let session: SyncSession | undefined;
|
|
42
|
+
const sessionFor = (ctx: ExtensionContext) => (session?.client.isFor(ctx.sessionManager) ? session : undefined);
|
|
43
|
+
const owns = (current: SyncSession) => session === current && current.client.isCurrent();
|
|
44
|
+
const exposeDebugTool = registerPiSyncDebug(pi, (ctx) => {
|
|
45
|
+
const current = sessionFor(ctx);
|
|
46
|
+
if (current?.client.debugEnabled) return { client: current.client, signal: current.client.signal };
|
|
47
|
+
});
|
|
41
48
|
|
|
42
49
|
pi.registerCommand("sync", {
|
|
43
50
|
description: "Sync Pi settings through Git, WebDAV, R2, or S3-compatible storage",
|
|
44
51
|
getArgumentCompletions: completeSyncArguments,
|
|
45
52
|
handler: async (args, ctx) => {
|
|
46
|
-
if (!ctx.hasUI
|
|
53
|
+
if (!ctx.hasUI || (ctx.mode !== "tui" && ctx.mode !== "rpc"))
|
|
54
|
+
throw new Error("/sync requires TUI or RPC mode so results and safety prompts are observable.");
|
|
47
55
|
const retired = retiredSyncCommandGuidance(splitArgs(args)[0]);
|
|
48
56
|
if (retired) {
|
|
49
57
|
ctx.ui.notify(retired, "warning");
|
|
50
58
|
return;
|
|
51
59
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
const current = sessionFor(ctx);
|
|
61
|
+
if (!current || !owns(current)) {
|
|
62
|
+
if (beforeStart.signal.aborted || splitArgs(args)[0] !== "help") {
|
|
63
|
+
ctx.ui.notify(PI_SYNC_BINDING_UNAVAILABLE, "error");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
status.bind(ctx);
|
|
57
67
|
const commands = await loaders.commands();
|
|
58
|
-
if (signal.aborted
|
|
68
|
+
if (beforeStart.signal.aborted) return;
|
|
59
69
|
ctx.isIdle();
|
|
60
|
-
await commands.handleCommand(args, ctx, signal, loaders, attention);
|
|
70
|
+
await commands.handleCommand(args, ctx, beforeStart.signal, loaders, attention);
|
|
61
71
|
return;
|
|
62
72
|
}
|
|
73
|
+
const { client, check, initialization } = current;
|
|
74
|
+
const { signal } = client;
|
|
63
75
|
const reload = new AbortController();
|
|
64
76
|
const commandSignal = combineSignals(signal, reload.signal);
|
|
65
77
|
try {
|
|
@@ -69,7 +81,10 @@ export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDepende
|
|
|
69
81
|
const [command, action, ...extra] = splitArgs(args);
|
|
70
82
|
const recover = command === "daemon" && action === "recover";
|
|
71
83
|
const ready = recover ? undefined : await initialization;
|
|
72
|
-
if (
|
|
84
|
+
if (!owns(current)) {
|
|
85
|
+
if (session === current && !signal.aborted) ctx.ui.notify(PI_SYNC_BINDING_UNAVAILABLE, "error");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
73
88
|
const needsDaemonRecovery = () => client.ownershipCleanupRequired;
|
|
74
89
|
if (recover || (!command && needsDaemonRecovery())) {
|
|
75
90
|
if (recover && extra.length) {
|
|
@@ -77,7 +92,7 @@ export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDepende
|
|
|
77
92
|
return;
|
|
78
93
|
}
|
|
79
94
|
const commands = await loaders.commands();
|
|
80
|
-
if (
|
|
95
|
+
if (!owns(current)) return;
|
|
81
96
|
await commands.handleCommand(
|
|
82
97
|
args,
|
|
83
98
|
ctx,
|
|
@@ -95,9 +110,9 @@ export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDepende
|
|
|
95
110
|
try {
|
|
96
111
|
await client.setBusy("command", true, requiresContact);
|
|
97
112
|
busyPublished = requiresContact;
|
|
98
|
-
if (
|
|
113
|
+
if (!owns(current)) return;
|
|
99
114
|
if (!daemonStatus) await check.stop();
|
|
100
|
-
if (
|
|
115
|
+
if (!owns(current)) return;
|
|
101
116
|
if (
|
|
102
117
|
ready === false &&
|
|
103
118
|
command !== "help" &&
|
|
@@ -113,12 +128,12 @@ export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDepende
|
|
|
113
128
|
}
|
|
114
129
|
if (command === "unlock" || command === "migrate-state") {
|
|
115
130
|
const { stateDirectoryMigrationNotice } = await import("./state/state-directory.js");
|
|
116
|
-
if (
|
|
131
|
+
if (!owns(current)) return;
|
|
117
132
|
// Recovery cannot guess an authoritative root when roots coexist or are unsafe.
|
|
118
133
|
stateDirectoryMigrationNotice();
|
|
119
134
|
}
|
|
120
135
|
const commands = await loaders.commands();
|
|
121
|
-
if (
|
|
136
|
+
if (!owns(current)) return;
|
|
122
137
|
await commands.handleCommand(
|
|
123
138
|
args,
|
|
124
139
|
ctx,
|
|
@@ -130,12 +145,12 @@ export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDepende
|
|
|
130
145
|
);
|
|
131
146
|
} catch (error) {
|
|
132
147
|
client.recordOwnershipFailure(error);
|
|
133
|
-
if (!commandSignal.aborted &&
|
|
148
|
+
if (!commandSignal.aborted && owns(current)) {
|
|
134
149
|
ctx.ui.notify(`pi-sync command unavailable: ${safeTerminalText(errorMessage(error))}`, "error");
|
|
135
150
|
if (command === "unlock" || command === "migrate-state") throw error;
|
|
136
151
|
}
|
|
137
152
|
} finally {
|
|
138
|
-
if (
|
|
153
|
+
if (owns(current)) {
|
|
139
154
|
// Recovery can publish busy facts after bypassing the initial contact check.
|
|
140
155
|
const publish = busyPublished || daemonStatus || command === "unlock" || command === "migrate-state";
|
|
141
156
|
// Release local busy state even if contact failed; do not mask the command result.
|
|
@@ -144,9 +159,10 @@ export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDepende
|
|
|
144
159
|
}
|
|
145
160
|
},
|
|
146
161
|
reload,
|
|
162
|
+
client,
|
|
147
163
|
);
|
|
148
164
|
// Pi reload awaits our shutdown hook. Neither daemon work nor old UI may await reload.
|
|
149
|
-
if (
|
|
165
|
+
if (owns(current) && client.canReload(reload)) await ctx.reload();
|
|
150
166
|
} finally {
|
|
151
167
|
client.releaseReload(reload);
|
|
152
168
|
reload.abort();
|
|
@@ -154,52 +170,94 @@ export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDepende
|
|
|
154
170
|
},
|
|
155
171
|
});
|
|
156
172
|
pi.on("session_start", async (event, ctx) => {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
presence = registration;
|
|
169
|
-
const replacementFile = ctx.sessionManager.getSessionFile?.();
|
|
170
|
-
attention.reset(ctx);
|
|
171
|
-
const previous = initialization;
|
|
172
|
-
initialization = withPiDaemonClient(ctx, async () => {
|
|
173
|
-
await previous.catch(() => {});
|
|
174
|
-
if (signal.aborted || owner !== client) return false;
|
|
173
|
+
const previous = session;
|
|
174
|
+
const replaced = new DOMException("Session replaced", "AbortError");
|
|
175
|
+
beforeStart.abort(replaced);
|
|
176
|
+
previous?.shutdown?.abort?.abort(replaced);
|
|
177
|
+
previous?.abort.abort(replaced);
|
|
178
|
+
const previousCheck = previous?.check.stop();
|
|
179
|
+
const retirePrevious = async (replacementFile?: string) => {
|
|
180
|
+
if (!previous) return;
|
|
181
|
+
const shutdown = previous.shutdown?.done;
|
|
182
|
+
await previous.initialization.catch(() => {});
|
|
183
|
+
await previousCheck;
|
|
175
184
|
try {
|
|
176
|
-
await
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
await (shutdown ?? previous.client.disposeForShutdown("resume", replacementFile));
|
|
186
|
+
} catch {
|
|
187
|
+
/* Plain, detached recovery owns uncertain grants; no closed ctx is retained. */
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const abort = new AbortController();
|
|
191
|
+
let client: PiDaemonClient | undefined;
|
|
192
|
+
let releaseStatus: () => void;
|
|
193
|
+
try {
|
|
194
|
+
client = bindPiDaemonClient(ctx, abort.signal, publishTimings);
|
|
195
|
+
releaseStatus = status.start(ctx);
|
|
196
|
+
} catch (error) {
|
|
197
|
+
const retirement = retirePrevious();
|
|
198
|
+
if (previous && !previous.shutdown) previous.shutdown = { done: retirement };
|
|
199
|
+
abort.abort(error);
|
|
200
|
+
if (session === previous) {
|
|
201
|
+
try {
|
|
202
|
+
attention.reset(ctx);
|
|
203
|
+
} catch {}
|
|
204
|
+
}
|
|
205
|
+
await Promise.allSettled([retirement, client?.disposeForShutdown("resume")]);
|
|
206
|
+
previous?.releaseStatus();
|
|
207
|
+
if (session === previous) session = undefined;
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
const { signal } = client;
|
|
211
|
+
const check = createStartupCheck(loaders, attention, 30_000, publishTimings);
|
|
212
|
+
const current: SyncSession = {
|
|
213
|
+
client,
|
|
214
|
+
abort,
|
|
215
|
+
check,
|
|
216
|
+
releaseStatus,
|
|
217
|
+
initialization: Promise.resolve(undefined),
|
|
218
|
+
};
|
|
219
|
+
session = current;
|
|
220
|
+
current.initialization = Promise.resolve().then(async () => {
|
|
221
|
+
try {
|
|
222
|
+
let replacementFile: string | undefined;
|
|
223
|
+
try {
|
|
224
|
+
if (previous) await previous.initialization.catch(() => {});
|
|
225
|
+
if (!owns(current)) return false;
|
|
226
|
+
client.validate();
|
|
227
|
+
const manager = ctx.sessionManager;
|
|
228
|
+
replacementFile = manager.getSessionFile?.();
|
|
229
|
+
current.presence = sessionPresence(client.root, manager, event?.previousSessionFile);
|
|
230
|
+
attention.reset(ctx);
|
|
231
|
+
await current.presence.start(signal);
|
|
232
|
+
if (previous) {
|
|
233
|
+
await previousCheck;
|
|
234
|
+
if (!owns(current)) return false;
|
|
235
|
+
// Protect the replacement session before removing old session protection.
|
|
236
|
+
try {
|
|
237
|
+
await client.attachExisting({ allowUpgrade: true });
|
|
238
|
+
} catch {
|
|
239
|
+
/* Initialization below reports an unavailable owner. */
|
|
240
|
+
}
|
|
191
241
|
}
|
|
192
|
-
|
|
242
|
+
} finally {
|
|
243
|
+
await retirePrevious(replacementFile);
|
|
193
244
|
}
|
|
194
|
-
if (
|
|
195
|
-
|
|
245
|
+
if (!owns(current)) return false;
|
|
246
|
+
if (previous) await client.finishReattachment();
|
|
247
|
+
if (!owns(current)) return false;
|
|
248
|
+
return (await withPiDaemonClient(ctx, () => startSession(ctx, signal, publishTimings), undefined, client))
|
|
249
|
+
?.config;
|
|
196
250
|
} catch (error) {
|
|
197
|
-
if (!signal.aborted
|
|
251
|
+
if (session === current && !signal.aborted) {
|
|
198
252
|
try {
|
|
199
253
|
ctx.isIdle();
|
|
200
254
|
client.recordOwnershipFailure(error);
|
|
201
255
|
if (ctx.hasUI) {
|
|
202
|
-
const advice = client.
|
|
256
|
+
const advice = !client.isCurrent()
|
|
257
|
+
? ` ${PI_SYNC_BINDING_UNAVAILABLE}`
|
|
258
|
+
: client.ownershipCleanupRequired
|
|
259
|
+
? " Open /sync to recover the daemon."
|
|
260
|
+
: "";
|
|
203
261
|
ctx.ui.notify(`pi-sync recovery required: ${safeTerminalText(errorMessage(error))}${advice}`, "error");
|
|
204
262
|
}
|
|
205
263
|
} catch {
|
|
@@ -210,66 +268,90 @@ export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDepende
|
|
|
210
268
|
}
|
|
211
269
|
});
|
|
212
270
|
try {
|
|
213
|
-
const ready = await initialization;
|
|
214
|
-
if (!signal.aborted
|
|
271
|
+
const ready = await current.initialization;
|
|
272
|
+
if (session === current && !signal.aborted) exposeDebugTool(client.debugEnabled);
|
|
215
273
|
if (ready === false) {
|
|
216
274
|
client.disableQueueReleaseUI();
|
|
217
|
-
releaseStatus();
|
|
275
|
+
current.releaseStatus();
|
|
218
276
|
}
|
|
219
|
-
if (ready &&
|
|
220
|
-
await withPiDaemonClient(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
277
|
+
if (ready && owns(current) && (ready.automatic || startupTransferEnabled(ready)))
|
|
278
|
+
await withPiDaemonClient(
|
|
279
|
+
ctx,
|
|
280
|
+
async () => {
|
|
281
|
+
check.start(
|
|
282
|
+
ctx,
|
|
283
|
+
signal,
|
|
284
|
+
ready,
|
|
285
|
+
client.debugEnabled ? (report) => client.recordDebug({ event: "startup-timings", report }) : undefined,
|
|
286
|
+
);
|
|
287
|
+
},
|
|
288
|
+
undefined,
|
|
289
|
+
client,
|
|
290
|
+
);
|
|
228
291
|
} catch (error) {
|
|
229
292
|
client.disableQueueReleaseUI();
|
|
230
|
-
releaseStatus();
|
|
231
|
-
throw error;
|
|
293
|
+
current.releaseStatus();
|
|
294
|
+
if (owns(current)) throw error;
|
|
232
295
|
}
|
|
233
296
|
});
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (!
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
297
|
+
|
|
298
|
+
const whileOwned = async (ctx: ExtensionContext, action: (current: SyncSession) => Promise<void>) => {
|
|
299
|
+
const current = sessionFor(ctx);
|
|
300
|
+
if (!current || !owns(current)) return;
|
|
301
|
+
try {
|
|
302
|
+
await action(current);
|
|
303
|
+
} catch (error) {
|
|
304
|
+
if (owns(current)) throw error;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
pi.on("agent_start", (_event, ctx) =>
|
|
308
|
+
whileOwned(ctx, async (current) => {
|
|
309
|
+
const { client, check } = current;
|
|
310
|
+
if (!ctx.hasUI || !["tui", "rpc"].includes(ctx.mode)) {
|
|
311
|
+
await client.attachExisting();
|
|
312
|
+
if (!owns(current)) return;
|
|
313
|
+
}
|
|
314
|
+
await client.setBusy("agent", true);
|
|
315
|
+
if (owns(current)) await check.interrupt(ctx);
|
|
316
|
+
}),
|
|
317
|
+
);
|
|
318
|
+
pi.on("agent_settled", (_event, ctx) =>
|
|
319
|
+
whileOwned(ctx, async (current) => {
|
|
320
|
+
const { client, check } = current;
|
|
321
|
+
await client.setBusy("agent", false);
|
|
322
|
+
if (owns(current))
|
|
323
|
+
await withPiDaemonClient(
|
|
324
|
+
ctx,
|
|
325
|
+
async () => {
|
|
326
|
+
check.settled(ctx);
|
|
327
|
+
},
|
|
328
|
+
undefined,
|
|
329
|
+
client,
|
|
330
|
+
);
|
|
331
|
+
}),
|
|
332
|
+
);
|
|
333
|
+
pi.on("model_select", (_event, ctx) => whileOwned(ctx, ({ client }) => client.update()));
|
|
334
|
+
|
|
253
335
|
const pauseForReplacement = async (event: { type: string; targetSessionFile?: string }, ctx: ExtensionContext) => {
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
|
|
336
|
+
const current = sessionFor(ctx);
|
|
337
|
+
if (!current || current.client.signal.aborted) return;
|
|
338
|
+
const { client, presence, check } = current;
|
|
339
|
+
const { signal } = client;
|
|
340
|
+
if (!owns(current) || !presence) return { cancel: true };
|
|
258
341
|
const results = await Promise.allSettled([client.pauseForSessionChange(), check.stop()]);
|
|
259
|
-
if (
|
|
342
|
+
if (!owns(current)) return { cancel: true };
|
|
260
343
|
if (results.some((result) => result.status === "rejected")) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
);
|
|
344
|
+
ctx.ui.notify(
|
|
345
|
+
"pi-sync could not drain its writer. Repair or stop the existing daemon before changing sessions.",
|
|
346
|
+
"error",
|
|
347
|
+
);
|
|
266
348
|
return { cancel: true };
|
|
267
349
|
}
|
|
268
350
|
try {
|
|
269
|
-
await
|
|
270
|
-
if (
|
|
351
|
+
await presence.publish(event.targetSessionFile, !event.targetSessionFile, signal);
|
|
352
|
+
if (!owns(current)) return { cancel: true };
|
|
271
353
|
} catch (error) {
|
|
272
|
-
if (
|
|
354
|
+
if (owns(current) && ctx.hasUI)
|
|
273
355
|
ctx.ui.notify(`pi-sync could not protect the next session: ${safeTerminalText(errorMessage(error))}`, "error");
|
|
274
356
|
return { cancel: true };
|
|
275
357
|
}
|
|
@@ -278,69 +360,73 @@ export default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDepende
|
|
|
278
360
|
};
|
|
279
361
|
pi.on("session_before_switch", pauseForReplacement);
|
|
280
362
|
pi.on("session_before_fork", pauseForReplacement);
|
|
363
|
+
|
|
281
364
|
pi.on("session_shutdown", async (event, ctx) => {
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (!client || ownerManager !== ctx.sessionManager) {
|
|
286
|
-
releaseStatus();
|
|
365
|
+
const current = sessionFor(ctx);
|
|
366
|
+
if (!current) {
|
|
367
|
+
if (!session) status.cleanupFor(ctx)();
|
|
287
368
|
return;
|
|
288
369
|
}
|
|
370
|
+
if (current.shutdown) return current.shutdown.done;
|
|
371
|
+
const { client, check, initialization, releaseStatus } = current;
|
|
372
|
+
const canPush = owns(current);
|
|
289
373
|
const controller = new AbortController();
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
const
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
// Cancel old dialogs/settings work now, while the SDK context is still active.
|
|
297
|
-
sessionAbort.abort(new DOMException("Session shutting down", "AbortError"));
|
|
298
|
-
let shutdownClient: PiDaemonClient | undefined;
|
|
299
|
-
try {
|
|
300
|
-
await initialization.catch(() => {});
|
|
301
|
-
await check.stop();
|
|
302
|
-
if (signal.aborted || owner !== client) return;
|
|
303
|
-
await registration?.shutdown(target, signal);
|
|
304
|
-
if (signal.aborted || owner !== client) return;
|
|
305
|
-
if (reason !== "reload") {
|
|
306
|
-
shutdownClient = bindPiDaemonClient(ctx, signal, publishTimings);
|
|
307
|
-
shutdownClient.setDebugPreference(client.debugEnabled);
|
|
308
|
-
await shutdownClient.setBusy("shutdown", true);
|
|
309
|
-
const attached = await shutdownClient.attachExisting();
|
|
310
|
-
if (!signal.aborted && owner === client && attached)
|
|
311
|
-
await withPiDaemonClient(ctx, () => autoPushSessions(ctx, signal, loaders));
|
|
312
|
-
}
|
|
313
|
-
} catch (error) {
|
|
314
|
-
if (!signal.aborted && owner === client) {
|
|
315
|
-
try {
|
|
316
|
-
ctx.ui.notify(`pi-sync shutdown skipped: ${safeTerminalText(errorMessage(error))}`, "warning");
|
|
317
|
-
} catch {
|
|
318
|
-
/* SDK context was replaced. */
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
} finally {
|
|
322
|
-
if (owner === client) {
|
|
323
|
-
owner = undefined;
|
|
324
|
-
ownerManager = undefined;
|
|
325
|
-
presence = undefined;
|
|
326
|
-
try {
|
|
327
|
-
attention.reset(ctx);
|
|
328
|
-
} catch {
|
|
329
|
-
/* Cleanup never depends on an active SDK context. */
|
|
330
|
-
}
|
|
331
|
-
}
|
|
374
|
+
const signal = AbortSignal.any([controller.signal, client.replacementSignal, AbortSignal.timeout(30_000)]);
|
|
375
|
+
const isEnding = () => session === current && !signal.aborted;
|
|
376
|
+
const reason = event?.reason;
|
|
377
|
+
const target = event && "targetSessionFile" in event ? event.targetSessionFile : undefined;
|
|
378
|
+
const done = Promise.resolve().then(async () => {
|
|
379
|
+
let shutdownClient: PiDaemonClient | undefined;
|
|
332
380
|
try {
|
|
333
|
-
await
|
|
381
|
+
await initialization.catch(() => {});
|
|
382
|
+
await check.stop();
|
|
383
|
+
if (!isEnding()) return;
|
|
384
|
+
await current.presence?.shutdown(target, signal);
|
|
385
|
+
if (!isEnding() || !canPush || !client.ownsBinding() || reason === "reload") return;
|
|
386
|
+
const endingClient = client.createShutdownClient(ctx, signal);
|
|
387
|
+
shutdownClient = endingClient;
|
|
388
|
+
await endingClient.setDebugPreference(client.debugEnabled);
|
|
389
|
+
if (!isEnding() || !endingClient.isCurrent()) return;
|
|
390
|
+
await endingClient.setBusy("shutdown", true);
|
|
391
|
+
if (!isEnding() || !endingClient.isCurrent()) return;
|
|
392
|
+
const attached = await endingClient.attachExisting();
|
|
393
|
+
if (isEnding() && endingClient.isCurrent() && attached)
|
|
394
|
+
await withPiDaemonClient(ctx, (owned) => autoPushSessions(owned, signal, loaders), undefined, endingClient);
|
|
395
|
+
} catch (error) {
|
|
396
|
+
if (isEnding() && client.ownsBinding()) {
|
|
397
|
+
try {
|
|
398
|
+
ctx.ui.notify(`pi-sync shutdown skipped: ${safeTerminalText(errorMessage(error))}`, "warning");
|
|
399
|
+
} catch {
|
|
400
|
+
/* SDK context was replaced. */
|
|
401
|
+
}
|
|
402
|
+
}
|
|
334
403
|
} finally {
|
|
404
|
+
if (session === current) {
|
|
405
|
+
if (client.ownsBinding()) {
|
|
406
|
+
try {
|
|
407
|
+
attention.reset(ctx);
|
|
408
|
+
} catch {
|
|
409
|
+
/* Cleanup never depends on an active SDK context. */
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
335
413
|
try {
|
|
336
|
-
await
|
|
414
|
+
await client.disposeForShutdown(reason, target);
|
|
337
415
|
} finally {
|
|
338
|
-
|
|
339
|
-
|
|
416
|
+
try {
|
|
417
|
+
await shutdownClient?.disposeForShutdown(reason, target);
|
|
418
|
+
} finally {
|
|
419
|
+
controller.abort();
|
|
420
|
+
releaseStatus();
|
|
421
|
+
if (session === current) session = undefined;
|
|
422
|
+
}
|
|
340
423
|
}
|
|
341
424
|
}
|
|
342
|
-
|
|
343
|
-
}
|
|
425
|
+
});
|
|
426
|
+
current.shutdown = { abort: controller, done };
|
|
427
|
+
// Cancel old dialogs/settings work now, while the SDK context is still active.
|
|
428
|
+
current.abort.abort(new DOMException("Session shutting down", "AbortError"));
|
|
429
|
+
await done;
|
|
344
430
|
});
|
|
345
431
|
}
|
|
346
432
|
export type { SyncDependencies } from "./sync/sync-loaders.js";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/state/sync-state-store.ts", "../../src/ui/sync-attention.ts"],
|
|
4
|
-
"sourcesContent": ["export type * from \"@narumitw/pi-sync-daemon/engine/state/sync-state-store\";\nexport {\n ensureStateDir,\n lockPath,\n readState,\n readStateForConfig,\n statePathForConfig,\n syncStateFingerprint,\n writeState,\n writeStateForConfig,\n} from \"@narumitw/pi-sync-daemon/engine/state/sync-state-store\";\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { truncateToWidth } from \"@earendil-works/pi-tui\";\nimport type { EditorStatusWidgetState } from \"@narumitw/pi-tui-kit/editor-status-widget\";\nimport { syncCheckConfigFingerprint, syncConfigReviewFingerprint } from \"../settings/config.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { sameSyncExclude } from \"../sync/exclude-policy.js\";\nimport type { StartupObservation } from \"../sync/sync-inspection.js\";\nimport { type RemoteSelectionDecision, sameSyncInclude, syncDirectoryPolicyKey } from \"../sync/sync-policy.js\";\nimport { setSyncStatus } from \"./sync-status.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nconst WIDGET_KEY = \"sync:attention\";\n\nexport type SyncAttentionOrigin = \"sync\" | \"pull\" | \"push\";\n\nexport interface SyncAttentionState {\n decision: RemoteSelectionDecision;\n origin: SyncAttentionOrigin;\n offered: boolean;\n}\n\nexport function syncAttentionMatchesConfig(attention: SyncAttentionState, config: AnySyncConfig) {\n return (\n attention.decision.setupName === config.setupName &&\n attention.decision.configIdentity === syncConfigReviewFingerprint(config) &&\n sameSyncInclude(attention.decision.localInclude, config.include) &&\n sameSyncExclude(attention.decision.localExclude, config.exclude) &&\n syncDirectoryPolicyKey(config) ===\n syncDirectoryPolicyKey({\n include: attention.decision.localInclude,\n exclude: attention.decision.localExclude,\n ...attention.decision.localDirectory,\n })\n );\n}\n\nexport interface SyncAttentionController {\n observe(observation: StartupObservation): void;\n observation(): StartupObservation | undefined;\n clearObservation(): void;\n notifyObservation(ctx: ExtensionContext): void;\n set(decision: RemoteSelectionDecision, origin: SyncAttentionOrigin): void;\n current(): SyncAttentionState | undefined;\n markOffered(): boolean;\n clear(ctx: ExtensionContext): void;\n reset(ctx: ExtensionContext): void;\n expand(): void;\n publish(ctx: ExtensionContext, signal?: AbortSignal): Promise<void>;\n}\n\nexport function createSyncAttentionController(): SyncAttentionController {\n let state: SyncAttentionState | undefined;\n let observation: StartupObservation | undefined;\n let generation = 0;\n let widgetState: EditorStatusWidgetState = { collapsed: false };\n\n return {\n observe(value) {\n generation++;\n observation = value;\n },\n observation() {\n return observation;\n },\n clearObservation() {\n generation++;\n observation = undefined;\n },\n notifyObservation(ctx) {\n if (ctx.hasUI && observation && observationNeedsAttention(observation)) {\n ctx.ui.notify(observationLines(observation).join(\"\\n\"), \"warning\");\n }\n },\n set(decision, origin) {\n generation++;\n state = { decision, origin, offered: false };\n },\n current() {\n return state;\n },\n markOffered() {\n if (!state || state.offered) return false;\n state = { ...state, offered: true };\n return true;\n },\n clear(ctx) {\n generation++;\n state = undefined;\n clearAttentionPresentation(ctx);\n },\n reset(ctx) {\n generation++;\n state = undefined;\n observation = undefined;\n widgetState = { collapsed: false };\n clearAttentionPresentation(ctx);\n },\n expand() {\n widgetState.collapsed = false;\n },\n async publish(ctx, signal) {\n const currentGeneration = ++generation;\n if (signal?.aborted || !ctx.hasUI) return;\n const classification = observation ? classifyObservation(observation) : \"none\";\n if (!state && (classification === \"none\" || classification === \"guidance\")) {\n clearAttentionPresentation(ctx);\n return;\n }\n if (!state && classification === \"status\") {\n ctx.ui.setWidget(WIDGET_KEY, undefined);\n setSyncStatus(ctx, observation?.inspection.remoteChanged ? \"sync \u21E3\" : \"sync \u21E1\", {\n activity: observation?.inspection.remoteChanged ? \"remote-change\" : \"local-change\",\n });\n return;\n }\n const setupName = safeTerminalText(state?.decision.setupName ?? observation?.setupName ?? \"\");\n if (ctx.mode !== \"tui\") {\n ctx.ui.setWidget(WIDGET_KEY, undefined);\n setSyncStatus(ctx, \"sync \u21D5\", { activity: \"review\" });\n return;\n }\n // Keep Kit outside the eager startup graph; module loading owns no cancellable resources.\n const { EditorStatusWidget } = await import(\"./attention-widget.js\").catch((error) => {\n if (generation === currentGeneration && !signal?.aborted) clearAttentionPresentation(ctx);\n throw error;\n });\n if (generation !== currentGeneration || signal?.aborted) return;\n setSyncStatus(ctx, \"sync \u21D5\", { activity: \"review\" });\n const presentationState = widgetState;\n ctx.ui.setWidget(\n WIDGET_KEY,\n (_tui, theme) =>\n new EditorStatusWidget({\n theme,\n name: \"Sync\",\n summary: \"Needs review\",\n state: presentationState,\n renderBody: (width) => [\n width === 0 ? \"\" : truncateToWidth(theme.fg(\"muted\", `Open /sync to review \u00B7 ${setupName}`), width, \"\u2026\"),\n ],\n }),\n );\n },\n };\n}\n\nexport function observationMatchesConfig(observation: StartupObservation, config: AnySyncConfig) {\n return observation.configIdentity === syncCheckConfigFingerprint(config);\n}\n\nexport function observationSummary(observation: StartupObservation) {\n const result = observation.inspection;\n if (result.emptyInclude) return \"No included content selected\";\n if (result.selectionState?.kind === \"different\") return \"Synced-content list differs; review needed\";\n if (result.firstSync)\n return result.head ? \"No sync baseline; review remote and local content\" : \"Remote empty; no sync baseline\";\n if (!result.head) return \"Remote snapshot missing; review needed\";\n if (observation.automaticTransfer && result.selectionState?.kind === \"legacy\")\n return \"Legacy remote has no authoritative content list; review /sync and choose an explicit direction to adopt policy\";\n if (result.localChanged && result.remoteChanged) return \"Local and remote changed since last sync; review needed\";\n if (result.remoteChanged) return \"Remote changed since last sync\";\n if (result.localChanged) return \"Local content changed since last sync\";\n if (result.selectionState?.kind === \"legacy\") return \"Legacy remote has no authoritative content list\";\n return \"No changes detected since last sync\";\n}\n\nexport type ObservationClassification = \"none\" | \"guidance\" | \"status\" | \"review\";\n\n/** Presentation only: never discard an observation or authorize a transfer here. */\nexport function classifyObservation(observation: StartupObservation): ObservationClassification {\n const result = observation.inspection;\n // Sync now exits before reading remote content when nothing is selected.\n if (result.emptyInclude) return \"guidance\";\n if (result.selectionState?.kind === \"different\") return \"review\";\n if (result.firstSync) return result.head ? \"review\" : \"guidance\";\n if (!result.head || (result.localChanged && result.remoteChanged)) return \"review\";\n if (observation.automaticTransfer && result.selectionState?.kind === \"legacy\") return \"review\";\n if (result.localChanged || result.remoteChanged) return \"status\";\n // Legacy metadata alone requires no scope confirmation in transfer operations.\n return \"none\";\n}\n\nexport function observationNeedsAttention(observation: StartupObservation) {\n return classifyObservation(observation) === \"review\";\n}\n\nfunction observationLines(observation: StartupObservation) {\n return [\n `Pi Sync check \u00B7 ${safeTerminalText(observation.setupName)}`,\n observationSummary(observation),\n \"No startup transfer \u00B7 Run /sync to review\",\n ];\n}\n\nfunction clearAttentionPresentation(ctx: ExtensionContext) {\n if (!ctx.hasUI) return;\n setSyncStatus(ctx, undefined);\n ctx.ui.setWidget(WIDGET_KEY, undefined);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACTP,SAAS,uBAAuB;AAUhC,IAAM,aAAa;AAUZ,SAAS,2BAA2B,WAA+B,QAAuB;AAC/F,SACE,UAAU,SAAS,cAAc,OAAO,aACxC,UAAU,SAAS,mBAAmB,4BAA4B,MAAM,KACxE,gBAAgB,UAAU,SAAS,cAAc,OAAO,OAAO,KAC/D,gBAAgB,UAAU,SAAS,cAAc,OAAO,OAAO,KAC/D,uBAAuB,MAAM,MAC3B,uBAAuB;AAAA,IACrB,SAAS,UAAU,SAAS;AAAA,IAC5B,SAAS,UAAU,SAAS;AAAA,IAC5B,GAAG,UAAU,SAAS;AAAA,EACxB,CAAC;AAEP;AAgBO,SAAS,gCAAyD;AACvE,MAAI;AACJ,MAAI;AACJ,MAAI,aAAa;AACjB,MAAI,cAAuC,EAAE,WAAW,MAAM;AAE9D,SAAO;AAAA,IACL,QAAQ,OAAO;AACb;AACA,oBAAc;AAAA,IAChB;AAAA,IACA,cAAc;AACZ,aAAO;AAAA,IACT;AAAA,IACA,mBAAmB;AACjB;AACA,oBAAc;AAAA,IAChB;AAAA,IACA,kBAAkB,KAAK;AACrB,UAAI,IAAI,SAAS,eAAe,0BAA0B,WAAW,GAAG;AACtE,YAAI,GAAG,OAAO,iBAAiB,WAAW,EAAE,KAAK,IAAI,GAAG,SAAS;AAAA,MACnE;AAAA,IACF;AAAA,IACA,IAA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