@narumitw/pi-sync 0.60.4 → 0.61.0
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 +24 -0
- package/README.md +14 -6
- package/dist/chunks/chunk-2JHAN3ZO.ts +139 -0
- package/dist/chunks/chunk-2JHAN3ZO.ts.map +7 -0
- package/dist/chunks/chunk-2ZGV5KNC.ts +274 -0
- package/dist/chunks/chunk-2ZGV5KNC.ts.map +7 -0
- package/dist/chunks/{chunk-LAXTCSX4.ts → chunk-4KTJLJSJ.ts} +117 -132
- package/dist/chunks/chunk-4KTJLJSJ.ts.map +7 -0
- package/dist/chunks/chunk-4SR3ZYHA.ts +14 -0
- package/dist/chunks/chunk-4SR3ZYHA.ts.map +7 -0
- package/dist/chunks/{chunk-VQRDL3SY.ts → chunk-E3YLRLJM.ts} +155 -27
- package/dist/chunks/chunk-E3YLRLJM.ts.map +7 -0
- package/dist/chunks/{chunk-KPWZNMKM.ts → chunk-ECYCNZOE.ts} +1 -5
- package/dist/chunks/chunk-ECYCNZOE.ts.map +7 -0
- package/dist/chunks/{chunk-IGDI5CIH.ts → chunk-EMVZL4PH.ts} +2 -2
- package/dist/chunks/{chunk-OVCP2SOB.ts → chunk-H7VOTY5N.ts} +21 -8
- package/dist/chunks/chunk-H7VOTY5N.ts.map +7 -0
- package/dist/chunks/{chunk-SE7HHBKH.ts → chunk-JVFCVPPD.ts} +105 -51
- package/dist/chunks/chunk-JVFCVPPD.ts.map +7 -0
- package/dist/chunks/{chunk-MCUZFUHY.ts → chunk-PJMM75W5.ts} +6 -6
- package/dist/chunks/{chunk-RJZIKZI3.ts → chunk-S7F4FOAS.ts} +11 -6
- package/dist/chunks/chunk-S7F4FOAS.ts.map +7 -0
- package/dist/chunks/{chunk-6W2SNZ5P.ts → chunk-YQSFJLJ3.ts} +6 -2
- package/dist/chunks/{chunk-6W2SNZ5P.ts.map → chunk-YQSFJLJ3.ts.map} +3 -3
- package/dist/chunks/{chunk-V4AMI3VL.ts → chunk-ZVGRZD4C.ts} +9 -1
- package/dist/chunks/chunk-ZVGRZD4C.ts.map +7 -0
- package/dist/chunks/{command-handler-TMH4US44.ts → command-handler-K4XJOGYC.ts} +41 -37
- package/dist/chunks/{command-handler-TMH4US44.ts.map → command-handler-K4XJOGYC.ts.map} +2 -2
- package/dist/chunks/{conflict-review-QGUCODDH.ts → conflict-review-IGKY2TOJ.ts} +4 -4
- package/dist/chunks/{file-selection-DD6X4J2K.ts → file-selection-MGGVOKM7.ts} +26 -13
- package/dist/chunks/file-selection-MGGVOKM7.ts.map +7 -0
- package/dist/chunks/{manager-result-dispatcher-YVVD44QD.ts → manager-result-dispatcher-4VJVDEUD.ts} +8 -7
- package/dist/chunks/{manager-ui-Q54OHOPR.ts → manager-ui-KYQ5AZJS.ts} +134 -203
- package/dist/chunks/manager-ui-KYQ5AZJS.ts.map +7 -0
- package/dist/chunks/{remote-selection-ui-ODSUHX5N.ts → remote-selection-ui-W3KOZM3W.ts} +7 -6
- package/dist/chunks/{setup-switch-SPZE7HIQ.ts → setup-switch-D6K6PBPC.ts} +3 -3
- package/dist/chunks/{setup-wizard-5JYKAEIT.ts → setup-wizard-4DYUDHJR.ts} +13 -11
- package/dist/chunks/setup-wizard-4DYUDHJR.ts.map +7 -0
- package/dist/chunks/{sync-inspection-ECUTWISE.ts → sync-inspection-J3CRBORL.ts} +6 -6
- package/dist/chunks/{sync-operations-REXODWZB.ts → sync-operations-BVWYYKH3.ts} +4 -4
- package/dist/index.ts +28 -24
- package/dist/index.ts.map +2 -2
- package/docs/daemon-migration.md +6 -0
- package/package.json +4 -4
- package/skills/configure-pi-sync/references/configuration.md +59 -32
- package/src/commands/command-execution.ts +7 -1
- package/src/daemon/pi-client.ts +79 -22
- package/src/daemon/queue-release-ui.ts +88 -0
- package/src/sync/sync-policy.ts +5 -0
- package/src/sync-extension.ts +6 -2
- package/src/ui/agent-mode-setting.ts +9 -1
- package/src/ui/excluded-paths-ui.ts +154 -2
- package/src/ui/file-selection.ts +12 -7
- package/src/ui/manager-state.ts +13 -8
- package/src/ui/remote-selection-ui.ts +120 -27
- package/src/ui/settings-frame.ts +2 -8
- package/src/ui/settings-ui.ts +51 -26
- package/src/ui/setup/directory-rules.ts +81 -0
- package/src/ui/setup/git-ui.ts +14 -24
- package/src/ui/setup/s3-ui.ts +13 -26
- package/src/ui/setup/setup-actions.ts +0 -4
- package/src/ui/setup/setup-prompts.ts +99 -17
- package/src/ui/setup/setup-switcher.ts +4 -2
- package/src/ui/setup/setup-wizard.ts +5 -4
- package/src/ui/setup/webdav-ui.ts +13 -27
- package/src/ui/storage-connections-ui.ts +2 -2
- package/src/ui/sync-attention.ts +8 -3
- package/src/ui/sync-format.ts +8 -1
- package/src/ui/sync-setups-ui.ts +5 -3
- package/src/ui/sync-status.ts +27 -7
- package/dist/chunks/chunk-KPWZNMKM.ts.map +0 -7
- package/dist/chunks/chunk-LAXTCSX4.ts.map +0 -7
- package/dist/chunks/chunk-OVCP2SOB.ts.map +0 -7
- package/dist/chunks/chunk-RJZIKZI3.ts.map +0 -7
- package/dist/chunks/chunk-SE7HHBKH.ts.map +0 -7
- package/dist/chunks/chunk-V4AMI3VL.ts.map +0 -7
- package/dist/chunks/chunk-VQRDL3SY.ts.map +0 -7
- package/dist/chunks/file-selection-DD6X4J2K.ts.map +0 -7
- package/dist/chunks/manager-ui-Q54OHOPR.ts.map +0 -7
- package/dist/chunks/setup-wizard-5JYKAEIT.ts.map +0 -7
- /package/dist/chunks/{chunk-IGDI5CIH.ts.map → chunk-EMVZL4PH.ts.map} +0 -0
- /package/dist/chunks/{chunk-MCUZFUHY.ts.map → chunk-PJMM75W5.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-QGUCODDH.ts.map → conflict-review-IGKY2TOJ.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-YVVD44QD.ts.map → manager-result-dispatcher-4VJVDEUD.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-ODSUHX5N.ts.map → remote-selection-ui-W3KOZM3W.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-SPZE7HIQ.ts.map → setup-switch-D6K6PBPC.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-ECUTWISE.ts.map → sync-inspection-J3CRBORL.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-REXODWZB.ts.map → sync-operations-BVWYYKH3.ts.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ui/sync-status.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionAPI, ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport type { ContinuousErrorKind } from \"../sync/continuous-errors.js\";\n\nconst STATUS_KEY = \"sync\";\n\ntype SyncStatusContext = Pick<ExtensionContext, \"hasUI\" | \"sessionManager\" | \"ui\">;\n\nexport type SyncStatusPresentation =\n | {\n activity:\n | \"idle\"\n | \"checking\"\n | \"working\"\n | \"pushing\"\n | \"pulling\"\n | \"resolving\"\n | \"local-change\"\n | \"remote-change\"\n | \"review\";\n reason?: never;\n }\n | { activity: \"retry\" | \"blocked\"; reason: SyncStatusReason };\n\ntype SyncStatusReason =\n | \"temp\"\n | \"busy\"\n | \"stale\"\n | \"auth\"\n | \"storage\"\n | \"review\"\n | \"model\"\n | \"limit\"\n | \"unknown\"\n | \"repair\";\n\nconst failureReasons: Record<ContinuousErrorKind, SyncStatusReason> = {\n transient: \"temp\",\n contention: \"busy\",\n stale: \"stale\",\n authentication: \"auth\",\n storage: \"storage\",\n unsafe: \"review\",\n model: \"model\",\n budget: \"limit\",\n unknown: \"unknown\",\n};\n\nexport function syncStatusFailureReason(kind: ContinuousErrorKind | undefined): SyncStatusReason {\n return typeof kind === \"string\" && Object.hasOwn(failureReasons, kind) ? failureReasons[kind] : \"unknown\";\n}\n\nconst enabledBySession = new WeakMap<ExtensionContext[\"sessionManager\"], boolean>();\nconst publishersBySession = new WeakMap<ExtensionContext[\"sessionManager\"], StatusBinding>();\nconst statusesBySession = new WeakMap<ExtensionContext[\"sessionManager\"], StatusValue>();\nconst connectionStatusBySession = new WeakMap<ExtensionContext[\"sessionManager\"], StatusValue>();\nconst recoveryStatusBySession = new WeakMap<ExtensionContext[\"sessionManager\"], StatusValue>();\n\ninterface StatusValue {\n value: string;\n presentation?: SyncStatusPresentation;\n}\n\ninterface StatusBinding {\n update(value: string | undefined, presentation?: SyncStatusPresentation): void;\n release(): void;\n}\n\nfunction statusPresentation(presentation: SyncStatusPresentation | undefined): SyncStatusPresentation | undefined {\n if (!presentation) return;\n try {\n const { activity, reason } = presentation;\n if (activity === \"retry\" || activity === \"blocked\") {\n if (typeof reason === \"string\" && /^[a-z][a-z0-9-]{0,31}$/u.exec(reason)?.[0] === reason)\n return { activity, reason };\n } else if (\n [\n \"idle\",\n \"checking\",\n \"working\",\n \"pushing\",\n \"pulling\",\n \"resolving\",\n \"local-change\",\n \"remote-change\",\n \"review\",\n ].includes(activity) &&\n reason === undefined\n ) {\n return { activity };\n }\n } catch {\n // Invalid optional annotations withdraw metadata, not the readable status.\n }\n return undefined;\n}\n\n/** Optional extension-status v1 publisher; it owns no domain work or captured context. */\nexport function createSyncStatusPublisher(events: ExtensionAPI[\"events\"] | undefined) {\n let active: { sessionManager: ExtensionContext[\"sessionManager\"]; binding: StatusBinding } | undefined;\n let used = false;\n let activation = 0;\n const emit = (payload: object) => {\n try {\n events?.emit(\"extension-status:v1:update\", payload);\n } catch {\n // Optional delivery must not interrupt sync, including on minimal test buses.\n }\n };\n const bind = (ctx: SyncStatusContext): (() => void) => {\n if (!ctx.hasUI || (!active && used) || (active && active.sessionManager !== ctx.sessionManager)) return () => {};\n const { sessionManager } = ctx;\n if (active) {\n return publishersBySession.get(sessionManager) === active.binding ? active.binding.release : () => {};\n }\n const owner = activation;\n // Reserve first use before foreign cleanup can reenter this factory.\n used = true;\n publishersBySession.get(sessionManager)?.release();\n if (activation !== owner || publishersBySession.has(sessionManager)) return () => {};\n let current: ({ value: string } & SyncStatusPresentation) | undefined;\n let revision = 0;\n let unsubscribe: (() => void) | undefined;\n const isCurrent = () => publishersBySession.get(sessionManager) === binding;\n const publish = (requestId?: object) => {\n emit({\n version: 1,\n sessionManager,\n key: STATUS_KEY,\n ...(current ?? { value: undefined }),\n ...(requestId === undefined ? {} : { requestId }),\n });\n };\n const binding: StatusBinding = {\n update(value, presentation) {\n if (!isCurrent()) return;\n const owner = ++revision;\n const safePresentation = statusPresentation(presentation);\n if (!isCurrent() || revision !== owner) return;\n current = value && safePresentation ? { value, ...safePresentation } : undefined;\n publish();\n },\n release() {\n const owned = isCurrent();\n revision++;\n if (owned) {\n publishersBySession.delete(sessionManager);\n statusesBySession.delete(sessionManager);\n connectionStatusBySession.delete(sessionManager);\n recoveryStatusBySession.delete(sessionManager);\n current = undefined;\n }\n // Retire before optional callbacks; withdrawal observers cannot revive first-use binding.\n if (active?.binding === binding) active = undefined;\n const stop = unsubscribe;\n unsubscribe = undefined;\n try {\n stop?.();\n } catch {\n // A failing optional unsubscribe cannot stop lifecycle cleanup.\n }\n if (owned && !publishersBySession.has(sessionManager)) publish();\n },\n };\n active = { sessionManager, binding };\n used = true;\n publishersBySession.set(sessionManager, binding);\n try {\n unsubscribe = events?.on(\"extension-status:v1:request\", (payload) => {\n try {\n if (!isCurrent() || !payload || typeof payload !== \"object\" || Array.isArray(payload)) return;\n const {\n version,\n sessionManager: manager,\n requestId,\n } = payload as {\n version?: unknown;\n sessionManager?: unknown;\n requestId?: unknown;\n };\n if (\n !isCurrent() ||\n version !== 1 ||\n manager !== sessionManager ||\n !requestId ||\n typeof requestId !== \"object\"\n )\n return;\n publish(requestId);\n } catch {\n // Malformed requests and optional delivery cannot affect sync.\n }\n });\n } catch {\n // Raw status remains available when optional subscription fails.\n }\n return binding.release;\n };\n return {\n bind,\n start(ctx: SyncStatusContext) {\n const owner = ++activation;\n const { sessionManager } = ctx;\n const previous = publishersBySession.get(sessionManager);\n active?.binding.release();\n if (\n activation !== owner ||\n (publishersBySession.has(sessionManager) && publishersBySession.get(sessionManager) !== previous)\n )\n return () => {};\n // Only an explicit lifecycle start can reactivate a released publisher.\n used = false;\n const release = bind(ctx);\n used = true;\n // A superseded start must not receive the newer activation's cleanup capability.\n return activation === owner ? release : () => {};\n },\n cleanupFor(ctx: SyncStatusContext) {\n return active?.sessionManager === ctx.sessionManager ? active.binding.release : () => {};\n },\n };\n}\n\nexport function configureSyncStatus(ctx: SyncStatusContext, enabled: boolean) {\n enabledBySession.set(ctx.sessionManager, enabled);\n if (!enabled) {\n statusesBySession.delete(ctx.sessionManager);\n connectionStatusBySession.delete(ctx.sessionManager);\n recoveryStatusBySession.delete(ctx.sessionManager);\n renderSyncStatus(ctx);\n }\n}\n\nfunction renderSyncStatus(ctx: SyncStatusContext) {\n if (!ctx.hasUI) return;\n const { sessionManager } = ctx;\n const status = statusesBySession.get(sessionManager);\n const connection = connectionStatusBySession.get(sessionManager);\n const recovery = recoveryStatusBySession.get(sessionManager);\n const activity = status?.presentation?.activity;\n const normal = status && activity !== \"idle\" ? status : (connection ?? status);\n // Recovery explains a transfer's wait, but must not obscure confirmed failures or review.\n const current = activity === \"blocked\" || activity === \"review\" ? status : (recovery ?? normal);\n ctx.ui.setStatus(STATUS_KEY, current?.value);\n publishersBySession.get(sessionManager)?.update(current?.value, current?.presentation);\n}\n\nexport function setSyncStatus(\n ctx: SyncStatusContext,\n value: string | undefined,\n presentation?: SyncStatusPresentation,\n) {\n if (!ctx.hasUI || (value !== undefined && enabledBySession.get(ctx.sessionManager) === false)) return;\n const { sessionManager } = ctx;\n if (value === undefined) statusesBySession.delete(sessionManager);\n else {\n const status: StatusValue = { value };\n statusesBySession.set(sessionManager, status);\n status.presentation = statusPresentation(presentation);\n // An annotation getter can reenter publication or replace the session.\n if (statusesBySession.get(sessionManager) !== status) return;\n }\n renderSyncStatus(ctx);\n}\n\nfunction showOwnedStatus(\n statuses: WeakMap<ExtensionContext[\"sessionManager\"], StatusValue>,\n ctx: SyncStatusContext,\n value: string,\n presentation: SyncStatusPresentation,\n) {\n if (!ctx.hasUI || enabledBySession.get(ctx.sessionManager) === false) return (_redraw?: boolean) => {};\n const { sessionManager } = ctx;\n const status: StatusValue = { value };\n statuses.set(sessionManager, status);\n status.presentation = statusPresentation(presentation);\n if (statuses.get(sessionManager) === status) renderSyncStatus(ctx);\n return (redraw = true) => {\n if (statuses.get(sessionManager) !== status) return;\n statuses.delete(sessionManager);\n if (redraw) renderSyncStatus(ctx);\n };\n}\n\n/** Connection repair never clears or replaces a transfer or review status. */\nexport function showSyncConnectionStatus(ctx: SyncStatusContext, value: string, presentation: SyncStatusPresentation) {\n return showOwnedStatus(connectionStatusBySession, ctx, value, presentation);\n}\n\nexport function showSyncQueueReleaseRecovery(ctx: SyncStatusContext) {\n return showOwnedStatus(recoveryStatusBySession, ctx, \"sync recovering\", { activity: \"retry\", reason: \"temp\" });\n}\n"],
|
|
5
|
+
"mappings": ";;;;AAGA,IAAM,aAAa;AAgDnB,IAAM,mBAAmB,oBAAI,QAAqD;AAClF,IAAM,sBAAsB,oBAAI,QAA2D;AAC3F,IAAM,oBAAoB,oBAAI,QAAyD;AACvF,IAAM,4BAA4B,oBAAI,QAAyD;AAC/F,IAAM,0BAA0B,oBAAI,QAAyD;AAY7F,SAAS,mBAAmB,cAAsF;AAChH,MAAI,CAAC,aAAc;AACnB,MAAI;AACF,UAAM,EAAE,UAAU,OAAO,IAAI;AAC7B,QAAI,aAAa,WAAW,aAAa,WAAW;AAClD,UAAI,OAAO,WAAW,YAAY,0BAA0B,KAAK,MAAM,IAAI,CAAC,MAAM;AAChF,eAAO,EAAE,UAAU,OAAO;AAAA,IAC9B,WACE;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,SAAS,QAAQ,KACnB,WAAW,QACX;AACA,aAAO,EAAE,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AkB,IAAI,cAAc,MAAM,OAAQ;AAAA,EACxD;AACA,mBAAiB,GAAG;AACtB;AAEA,SAAS,gBACP,UACA,KACA,OACA,cACA;AACA,MAAI,CAAC,IAAI,SAAS,iBAAiB,IAAI,IAAI,cAAc,MAAM,MAAO,QAAO,CAAC,YAAsB;AAAA,EAAC;AACrG,QAAM,EAAE,eAAe,IAAI;AAC3B,QAAM,SAAsB,EAAE,MAAM;AACpC,WAAS,IAAI,gBAAgB,MAAM;AACnC,SAAO,eAAe,mBAAmB,YAAY;AACrD,MAAI,SAAS,IAAI,cAAc,MAAM,OAAQ,kBAAiB,GAAG;AACjE,SAAO,CAAC,SAAS,SAAS;AACxB,QAAI,SAAS,IAAI,cAAc,MAAM,OAAQ;AAC7C,aAAS,OAAO,cAAc;AAC9B,QAAI,OAAQ,kBAAiB,GAAG;AAAA,EAClC;AACF;AAGO,SAAS,yBAAyB,KAAwB,OAAe,cAAsC;AACpH,SAAO,gBAAgB,2BAA2B,KAAK,OAAO,YAAY;AAC5E;AAEO,SAAS,6BAA6B,KAAwB;AACnE,SAAO,gBAAgB,yBAAyB,KAAK,mBAAmB,EAAE,UAAU,SAAS,QAAQ,OAAO,CAAC;AAC/G;",
|
|
6
|
+
"names": ["owner"]
|
|
7
|
+
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
// @generated by scripts/build-runtime.mjs; do not edit.
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
|
+
import {
|
|
4
|
+
throwIfAborted
|
|
5
|
+
} from "./chunk-S3R3W3KF.ts";
|
|
6
|
+
import {
|
|
7
|
+
captureMutationOwner
|
|
8
|
+
} from "./chunk-4SR3ZYHA.ts";
|
|
9
|
+
import {
|
|
10
|
+
SyncSetupReviewChangedError,
|
|
11
|
+
updateSyncSetup
|
|
12
|
+
} from "./chunk-EMRFVLZM.ts";
|
|
3
13
|
import {
|
|
4
14
|
sameSyncExclude
|
|
5
15
|
} from "./chunk-HEB6YT64.ts";
|
|
@@ -10,25 +20,19 @@ import {
|
|
|
10
20
|
} from "./chunk-277VHM2P.ts";
|
|
11
21
|
import {
|
|
12
22
|
setSyncStatus
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
throwIfAborted
|
|
16
|
-
} from "./chunk-S3R3W3KF.ts";
|
|
17
|
-
import {
|
|
18
|
-
SyncSetupReviewChangedError,
|
|
19
|
-
updateSyncSetup
|
|
20
|
-
} from "./chunk-EMRFVLZM.ts";
|
|
23
|
+
} from "./chunk-H7VOTY5N.ts";
|
|
21
24
|
import {
|
|
22
25
|
errorMessage
|
|
23
26
|
} from "./chunk-ZIL6PW5L.ts";
|
|
24
|
-
import {
|
|
25
|
-
safeTerminalText
|
|
26
|
-
} from "./chunk-2JNFEZ3V.ts";
|
|
27
27
|
import {
|
|
28
28
|
compareSyncInclude,
|
|
29
29
|
inspectRemoteSelection,
|
|
30
|
-
sameSyncInclude
|
|
31
|
-
|
|
30
|
+
sameSyncInclude,
|
|
31
|
+
syncDirectoryPolicyKey
|
|
32
|
+
} from "./chunk-ZVGRZD4C.ts";
|
|
33
|
+
import {
|
|
34
|
+
safeTerminalText
|
|
35
|
+
} from "./chunk-2JNFEZ3V.ts";
|
|
32
36
|
|
|
33
37
|
// src/ui/remote-selection-ui.ts
|
|
34
38
|
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
@@ -44,13 +48,6 @@ import {
|
|
|
44
48
|
requireCompatibleRemoteSelection
|
|
45
49
|
} from "@narumitw/pi-sync-daemon/engine/sync/remote-snapshot";
|
|
46
50
|
|
|
47
|
-
// src/sync/sync-local.ts
|
|
48
|
-
import {
|
|
49
|
-
backupLocal,
|
|
50
|
-
captureMutationOwner,
|
|
51
|
-
protectedSessionPaths
|
|
52
|
-
} from "@narumitw/pi-sync-daemon/engine/sync/sync-local";
|
|
53
|
-
|
|
54
51
|
// src/ui/cancellable-operation.ts
|
|
55
52
|
import { BorderedLoader } from "@earendil-works/pi-coding-agent";
|
|
56
53
|
import { isKeyRelease, Key, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
|
|
@@ -273,18 +270,22 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
|
|
|
273
270
|
description: "Compare exact remote-only, device-only, and ordered lists.",
|
|
274
271
|
to: "review"
|
|
275
272
|
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
273
|
+
...adoptionUnavailable(state.decision) ? [] : [
|
|
274
|
+
{
|
|
275
|
+
id: "adopt",
|
|
276
|
+
label: "Use remote content list",
|
|
277
|
+
description: "Save the reviewed rules on this device without pulling files.",
|
|
278
|
+
action: "adopt"
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
...scopesDiffer(state.decision) ? [] : [
|
|
282
|
+
{
|
|
283
|
+
id: "keep",
|
|
284
|
+
label: "Keep this device's content list and update remote\u2026",
|
|
285
|
+
description: "Open the existing exact force-push preview without skipping confirmation.",
|
|
286
|
+
action: "keep"
|
|
287
|
+
}
|
|
288
|
+
],
|
|
288
289
|
{ id: "cancel", label: options.cancelLabel ?? "Cancel", action: "cancel" }
|
|
289
290
|
],
|
|
290
291
|
hint: "back"
|
|
@@ -332,6 +333,8 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
|
|
|
332
333
|
ownedSignal.throwIfAborted();
|
|
333
334
|
validateOwner();
|
|
334
335
|
assertLocalSelectionCurrent(currentConfig, state.decision);
|
|
336
|
+
const refusal = adoptionUnavailable(state.decision);
|
|
337
|
+
if (refusal) throw new Error(refusal);
|
|
335
338
|
if (!currentConfig.include.includes("sessions") && state.decision.remoteInclude.includes("sessions")) {
|
|
336
339
|
onDialog?.(true);
|
|
337
340
|
let acknowledged;
|
|
@@ -348,7 +351,7 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
|
|
|
348
351
|
validateOwner();
|
|
349
352
|
if (!acknowledged) return void 0;
|
|
350
353
|
}
|
|
351
|
-
if (state.decision.remoteExclude !== void 0 && currentConfig.exclude === void 0) {
|
|
354
|
+
if (!currentConfig.scope && state.decision.remoteExclude !== void 0 && currentConfig.exclude === void 0) {
|
|
352
355
|
onDialog?.(true);
|
|
353
356
|
let confirmed;
|
|
354
357
|
try {
|
|
@@ -386,7 +389,8 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
|
|
|
386
389
|
continuationFingerprint = syncCheckConfigFingerprint({
|
|
387
390
|
...adoption.value.config,
|
|
388
391
|
include: [...state.decision.remoteInclude],
|
|
389
|
-
exclude: adoptedExclude(state.decision)
|
|
392
|
+
exclude: adoptedExclude(state.decision),
|
|
393
|
+
...adoption.value.config.scope ? { reinclude: [...state.decision.remoteDirectory?.reinclude ?? []] } : {}
|
|
390
394
|
});
|
|
391
395
|
flowState = { decision: state.decision, saved: true };
|
|
392
396
|
return { kind: "to", screen: "saved" };
|
|
@@ -513,8 +517,8 @@ async function loadAdoptionReview(decision, signal, factory, validateOwner) {
|
|
|
513
517
|
const snapshot = await readSnapshotForHead(backend, reviewedHead, signal);
|
|
514
518
|
throwIfAborted(signal);
|
|
515
519
|
validateOwner();
|
|
516
|
-
const state = inspectRemoteSelection(config.include, snapshot, config.exclude);
|
|
517
|
-
if (state.kind !== "different" || !sameSyncInclude(state.include, decision.remoteInclude) || !sameSyncExclude(state.exclude, decision.remoteExclude)) {
|
|
520
|
+
const state = inspectRemoteSelection(config.include, snapshot, config.exclude, config);
|
|
521
|
+
if (state.kind !== "different" || !sameSyncInclude(state.include, decision.remoteInclude) || !sameSyncExclude(state.exclude, decision.remoteExclude) || !matchesRemoteDirectory(state, decision)) {
|
|
518
522
|
throw new StaleRemoteSelectionReviewError("Remote synced content changed while the comparison was open.");
|
|
519
523
|
}
|
|
520
524
|
return { config, backend, reviewedHead };
|
|
@@ -529,21 +533,36 @@ async function revalidateAndAdopt(review, decision, signal, validateOwner) {
|
|
|
529
533
|
const currentSnapshot = await readSnapshotForHead(review.backend, currentHead, signal);
|
|
530
534
|
throwIfAborted(signal);
|
|
531
535
|
validateOwner();
|
|
532
|
-
const currentState = inspectRemoteSelection(
|
|
533
|
-
|
|
536
|
+
const currentState = inspectRemoteSelection(
|
|
537
|
+
review.config.include,
|
|
538
|
+
currentSnapshot,
|
|
539
|
+
review.config.exclude,
|
|
540
|
+
review.config
|
|
541
|
+
);
|
|
542
|
+
if (currentState.kind !== "different" || !sameSyncInclude(currentState.include, decision.remoteInclude) || !sameSyncExclude(currentState.exclude, decision.remoteExclude) || !matchesRemoteDirectory(currentState, decision)) {
|
|
534
543
|
throw new StaleRemoteSelectionReviewError("Remote synced content changed while the comparison was open.");
|
|
535
544
|
}
|
|
536
545
|
await updateSyncSetup(
|
|
537
546
|
decision.setupName,
|
|
538
547
|
(setup) => {
|
|
539
548
|
validateOwner();
|
|
549
|
+
const refusal = adoptionUnavailable(decision);
|
|
550
|
+
if (refusal) throw new Error(refusal);
|
|
551
|
+
const exclude = adoptedExclude(decision);
|
|
552
|
+
if (setup.sync.scope === "agent-directory") {
|
|
553
|
+
return {
|
|
554
|
+
...setup,
|
|
555
|
+
sync: {
|
|
556
|
+
...setup.sync,
|
|
557
|
+
exclude,
|
|
558
|
+
reinclude: [...decision.remoteDirectory?.reinclude ?? []],
|
|
559
|
+
sessions: decision.remoteInclude.includes("sessions")
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
}
|
|
540
563
|
return {
|
|
541
564
|
...setup,
|
|
542
|
-
sync: {
|
|
543
|
-
...setup.sync,
|
|
544
|
-
include: [...decision.remoteInclude],
|
|
545
|
-
...adoptedExclude(decision) === void 0 ? {} : { exclude: adoptedExclude(decision) }
|
|
546
|
-
}
|
|
565
|
+
sync: { ...setup.sync, include: [...decision.remoteInclude], ...exclude === void 0 ? {} : { exclude } }
|
|
547
566
|
};
|
|
548
567
|
},
|
|
549
568
|
{
|
|
@@ -572,7 +591,7 @@ async function inspectConfiguredRemoteSelection(ctx, setupName, signal, factory,
|
|
|
572
591
|
return {
|
|
573
592
|
kind: "selection",
|
|
574
593
|
config,
|
|
575
|
-
state: inspectRemoteSelection(config.include, snapshot, config.exclude)
|
|
594
|
+
state: inspectRemoteSelection(config.include, snapshot, config.exclude, config)
|
|
576
595
|
};
|
|
577
596
|
}
|
|
578
597
|
async function showLegacyDiscovery(ctx, config, discovered, signal) {
|
|
@@ -618,19 +637,48 @@ async function showLegacyDiscovery(ctx, config, discovered, signal) {
|
|
|
618
637
|
function adoptedExclude(decision) {
|
|
619
638
|
return decision.remoteExclude === void 0 ? decision.localExclude === void 0 ? void 0 : [] : [...decision.remoteExclude];
|
|
620
639
|
}
|
|
640
|
+
function scopesDiffer(decision) {
|
|
641
|
+
return decision.localDirectory?.scope !== decision.remoteDirectory?.scope;
|
|
642
|
+
}
|
|
643
|
+
function adoptionUnavailable(decision) {
|
|
644
|
+
if (scopesDiffer(decision))
|
|
645
|
+
return "Scope differs. Configure a setup with the remote scope to join it; this location is not migrated in place.";
|
|
646
|
+
if (decision.remoteDirectory?.scope && decision.remoteInclude.includes("sessions") && !decision.localInclude.includes("sessions"))
|
|
647
|
+
return "Enable session sync explicitly in Settings before adopting these rules.";
|
|
648
|
+
}
|
|
649
|
+
function matchesRemoteDirectory(state, decision) {
|
|
650
|
+
return syncDirectoryPolicyKey(state) === syncDirectoryPolicyKey({
|
|
651
|
+
include: decision.remoteInclude,
|
|
652
|
+
exclude: decision.remoteExclude,
|
|
653
|
+
...decision.remoteDirectory
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
function directoryReviewLines(decision) {
|
|
657
|
+
if (!decision.localDirectory?.scope && !decision.remoteDirectory?.scope) return [];
|
|
658
|
+
const unavailable = adoptionUnavailable(decision);
|
|
659
|
+
return [
|
|
660
|
+
`Remote scope: ${decision.remoteDirectory?.scope ? "Pi agent directory" : "selected paths or legacy"}`,
|
|
661
|
+
`This device scope: ${decision.localDirectory?.scope ? "Pi agent directory" : "selected paths"}`,
|
|
662
|
+
`Remote re-included paths: ${safeList(decision.remoteDirectory?.reinclude ?? [])}`,
|
|
663
|
+
`This device re-included paths: ${safeList(decision.localDirectory?.reinclude ?? [])}`,
|
|
664
|
+
...unavailable ? [unavailable] : []
|
|
665
|
+
];
|
|
666
|
+
}
|
|
621
667
|
function selectionSummaryLines(decision) {
|
|
622
668
|
const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
|
|
623
669
|
return [
|
|
624
670
|
`Sync setup: ${safeTerminalText(decision.setupName)}`,
|
|
625
671
|
"Nothing changed. Review both lists before choosing what happens next.",
|
|
672
|
+
...directoryReviewLines(decision),
|
|
626
673
|
...excludeReviewLines(decision),
|
|
627
|
-
|
|
674
|
+
...!decision.localDirectory?.scope && !decision.remoteDirectory?.scope && comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? ["Only the ordering differs; membership is the same."] : [`Remote-only paths: ${comparison.remoteOnly.length} \xB7 Device-only paths: ${comparison.localOnly.length}`]
|
|
628
675
|
];
|
|
629
676
|
}
|
|
630
677
|
function formatSelectionDifference(decision) {
|
|
631
678
|
const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
|
|
632
679
|
return [
|
|
633
|
-
...
|
|
680
|
+
...directoryReviewLines(decision),
|
|
681
|
+
...!decision.localDirectory?.scope && !decision.remoteDirectory?.scope && comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? ["Only ordering differs; both lists contain the same paths.", ""] : [],
|
|
634
682
|
"Remote-only paths:",
|
|
635
683
|
...comparison.remoteOnly.length > 0 ? comparison.remoteOnly.map((item) => `+ ${safeTerminalText(item)}`) : ["(none)"],
|
|
636
684
|
"",
|
|
@@ -653,7 +701,8 @@ function formatRemoteSelectionSummary(decision) {
|
|
|
653
701
|
`Synced content for \u201C${safeTerminalText(decision.setupName)}\u201D differs from this device.`,
|
|
654
702
|
`Remote-only: ${safeList(comparison.remoteOnly)}`,
|
|
655
703
|
`Device-only: ${safeList(comparison.localOnly)}`,
|
|
656
|
-
...
|
|
704
|
+
...directoryReviewLines(decision),
|
|
705
|
+
...!decision.localDirectory?.scope && !decision.remoteDirectory?.scope && comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? [
|
|
657
706
|
"Only ordering differs.",
|
|
658
707
|
`Remote order: ${safeList(decision.remoteInclude)}`,
|
|
659
708
|
`Device order: ${safeList(decision.localInclude)}`
|
|
@@ -680,11 +729,17 @@ function decisionFromState(config, state) {
|
|
|
680
729
|
localInclude: [...config.include],
|
|
681
730
|
remoteInclude: [...state.include],
|
|
682
731
|
...config.exclude === void 0 ? {} : { localExclude: [...config.exclude] },
|
|
683
|
-
...state.exclude === void 0 ? {} : { remoteExclude: [...state.exclude] }
|
|
732
|
+
...state.exclude === void 0 ? {} : { remoteExclude: [...state.exclude] },
|
|
733
|
+
...config.scope ? { localDirectory: { scope: config.scope, reinclude: config.reinclude } } : {},
|
|
734
|
+
...state.scope ? { remoteDirectory: { scope: state.scope, reinclude: state.reinclude } } : {}
|
|
684
735
|
};
|
|
685
736
|
}
|
|
686
737
|
function assertLocalSelectionCurrent(config, decision) {
|
|
687
|
-
if (syncConfigReviewFingerprint(config) === decision.configIdentity && sameSyncInclude(config.include, decision.localInclude) && sameSyncExclude(config.exclude, decision.localExclude)) {
|
|
738
|
+
if (syncConfigReviewFingerprint(config) === decision.configIdentity && sameSyncInclude(config.include, decision.localInclude) && sameSyncExclude(config.exclude, decision.localExclude) && syncDirectoryPolicyKey(config) === syncDirectoryPolicyKey({
|
|
739
|
+
include: decision.localInclude,
|
|
740
|
+
exclude: decision.localExclude,
|
|
741
|
+
...decision.localDirectory
|
|
742
|
+
})) {
|
|
688
743
|
return;
|
|
689
744
|
}
|
|
690
745
|
throw new StaleRemoteSelectionReviewError(
|
|
@@ -734,8 +789,7 @@ function combineSignals(sessionSignal, actionSignal) {
|
|
|
734
789
|
}
|
|
735
790
|
|
|
736
791
|
export {
|
|
737
|
-
captureMutationOwner,
|
|
738
792
|
runCancellableOperation,
|
|
739
793
|
showRemoteSelectionReview
|
|
740
794
|
};
|
|
741
|
-
//# sourceMappingURL=chunk-
|
|
795
|
+
//# sourceMappingURL=chunk-JVFCVPPD.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ui/remote-selection-ui.ts", "../../src/backends/backend-factory.ts", "../../src/sync/remote-snapshot.ts", "../../src/ui/cancellable-operation.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { createSyncBackend, type SyncBackendFactory } from \"../backends/backend-factory.js\";\nimport type { RemoteHead, SyncBackend } from \"../backends/sync-backend.js\";\nimport { loadConfig, syncCheckConfigFingerprint, syncConfigReviewFingerprint } from \"../settings/config.js\";\nimport { SyncSetupReviewChangedError, updateSyncSetup } from \"../settings/settings-management.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { sameSyncExclude } from \"../sync/exclude-policy.js\";\nimport { readSnapshotForHead } from \"../sync/remote-snapshot.js\";\nimport { throwIfAborted } from \"../sync/signals.js\";\nimport { errorMessage } from \"../sync/sync-errors.js\";\nimport { captureMutationOwner } from \"../sync/sync-local.js\";\nimport {\n compareSyncInclude,\n inspectRemoteSelection,\n type RemoteSelectionDecision,\n type RemoteSelectionState,\n sameSyncInclude,\n syncDirectoryPolicyKey,\n} from \"../sync/sync-policy.js\";\nimport {\n type RunRoute,\n type RunRouteResult,\n runCancellableOperation,\n runCancellableTask,\n} from \"./cancellable-operation.js\";\nimport { setSyncStatus } from \"./sync-status.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nexport type RemoteSelectionOrigin = \"settings\" | \"sync\" | \"pull\" | \"push\";\n\nexport interface RemoteSelectionReviewOptions {\n decision?: RemoteSelectionDecision;\n origin?: RemoteSelectionOrigin;\n runRoute?: RunRoute;\n cancelLabel?: string;\n /** The explicit mismatch is resolved or superseded; this does not imply file equality. */\n onSelectionResolved?: () => void;\n withStateAccess?: <T>(task: () => Promise<T>) => Promise<T>;\n}\n\nexport type RemoteSelectionReviewResult =\n | { kind: \"back\" }\n | { kind: \"closed\" }\n | { kind: \"done\" }\n | { kind: \"stale\" }\n | { kind: \"route-result\"; result: RunRouteResult; route: \"sync\" | \"pull\" | \"push\" };\n\nexport async function showRemoteSelectionReview(\n ctx: ExtensionContext,\n setupName?: string,\n signal?: AbortSignal,\n factory: SyncBackendFactory = createSyncBackend,\n options: RemoteSelectionReviewOptions = {},\n): Promise<RemoteSelectionReviewResult> {\n const validateOwner = captureMutationOwner(ctx, signal);\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n try {\n validateOwner();\n let decision = options.decision;\n if (!decision) {\n const inspection = await runCancellableTask(\n ctx,\n \"Checking remote content list\u2026\",\n (workSignal) => inspectConfiguredRemoteSelection(ctx, setupName, workSignal, factory, validateOwner),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (inspection.kind !== \"completed\") return { kind: inspection.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const inspected = inspection.value;\n if (!inspected) return { kind: \"stale\" };\n // A successful fresh read can supersede an old explicit mismatch without\n // changing local settings. This is not user cancellation or proof of file equality.\n if (inspected.kind === \"empty\" || inspected.state.kind !== \"different\") {\n options.onSelectionResolved?.();\n }\n if (inspected.kind === \"empty\") {\n ctx.ui.notify(\"Remote storage has no snapshot or synced-content list yet.\", \"info\");\n return { kind: \"back\" };\n }\n if (inspected.state.kind === \"same\") {\n ctx.ui.notify(\"Remote synced content already matches this sync setup.\", \"info\");\n return { kind: \"back\" };\n }\n if (inspected.state.kind === \"legacy\") {\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatLegacySummary(inspected.config, inspected.state.discovered), \"info\");\n return { kind: \"back\" };\n }\n await showLegacyDiscovery(ctx, inspected.config, inspected.state.discovered, signal);\n return signal?.aborted ? { kind: \"stale\" } : { kind: \"back\" };\n }\n decision = decisionFromState(inspected.config, inspected.state);\n }\n\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatRemoteSelectionSummary(decision), \"warning\");\n return { kind: \"back\" };\n }\n\n let currentDecision = decision;\n for (;;) {\n if (signal?.aborted) return { kind: \"stale\" };\n const result = await showSelectionDifference(\n ctx,\n currentDecision,\n options.origin ?? \"settings\",\n options.runRoute,\n signal,\n factory,\n options,\n validateOwner,\n );\n if (result.kind !== \"refresh\") return result;\n const refresh = await runCancellableTask(\n ctx,\n \"Refreshing remote content list\u2026\",\n (workSignal) =>\n runWithOptionalStateAccess(options, () =>\n inspectConfiguredRemoteSelection(ctx, currentDecision.setupName, workSignal, factory, validateOwner),\n ),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (refresh.kind !== \"completed\") return { kind: refresh.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const refreshed = refresh.value;\n if (!refreshed) return { kind: \"stale\" };\n if (refreshed.kind === \"empty\") {\n options.onSelectionResolved?.();\n ctx.ui.notify(\"Remote storage no longer has a snapshot or synced-content list.\", \"warning\");\n return { kind: \"back\" };\n }\n if (refreshed.state.kind !== \"different\") {\n ctx.ui.notify(\n refreshed.state.kind === \"same\"\n ? \"Remote synced content now matches this sync setup.\"\n : \"The refreshed legacy snapshot has no authoritative synced-content list.\",\n \"info\",\n );\n options.onSelectionResolved?.();\n return { kind: \"done\" };\n }\n currentDecision = decisionFromState(refreshed.config, refreshed.state);\n }\n } catch (error) {\n if (!isCurrent()) return { kind: \"stale\" };\n ctx.ui.notify(`Could not review synced content: ${errorMessage(error)}`, \"error\");\n return { kind: \"back\" };\n } finally {\n if (isCurrent()) setSyncStatus(ctx, undefined);\n }\n}\n\ntype DifferenceFlowResult = RemoteSelectionReviewResult | { kind: \"refresh\" };\n\nasync function showSelectionDifference(\n ctx: ExtensionContext,\n initialDecision: RemoteSelectionDecision,\n origin: RemoteSelectionOrigin,\n runRoute: RunRoute | undefined,\n sessionSignal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n options: Pick<RemoteSelectionReviewOptions, \"cancelLabel\" | \"onSelectionResolved\" | \"withStateAccess\">,\n validateOwner: () => void,\n): Promise<DifferenceFlowResult> {\n type Screen = \"choice\" | \"review\" | \"saved\";\n type Action = \"adopt\" | \"keep\" | \"cancel\" | \"continue\" | \"done\";\n interface FlowState {\n decision: RemoteSelectionDecision;\n saved: boolean;\n }\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n let flowState: FlowState = { decision: initialDecision, saved: false };\n let continuationFingerprint: string | undefined;\n let nextResult: RemoteSelectionReviewResult | undefined;\n let refreshRequested = false;\n const route = origin === \"settings\" ? \"sync\" : origin;\n const menu = defineMenu<FlowState, Screen, Action, ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: ({ state }) => ({\n kind: \"actions\",\n title: \"Synced content differs\",\n lines: selectionSummaryLines(state.decision),\n items: [\n {\n id: \"review\",\n label: \"Review all paths (recommended)\",\n description: \"Compare exact remote-only, device-only, and ordered lists.\",\n to: \"review\",\n },\n ...(adoptionUnavailable(state.decision)\n ? []\n : [\n {\n id: \"adopt\",\n label: \"Use remote content list\",\n description: \"Save the reviewed rules on this device without pulling files.\",\n action: \"adopt\" as const,\n },\n ]),\n ...(scopesDiffer(state.decision)\n ? []\n : [\n {\n id: \"keep\",\n label: \"Keep this device's content list and update remote\u2026\",\n description: \"Open the existing exact force-push preview without skipping confirmation.\",\n action: \"keep\" as const,\n },\n ]),\n { id: \"cancel\", label: options.cancelLabel ?? \"Cancel\", action: \"cancel\" },\n ],\n hint: \"back\",\n }),\n review: ({ state }) => ({\n kind: \"review\",\n title: `Review synced content \u00B7 ${safeTerminalText(state.decision.setupName)}`,\n content: formatSelectionDifference(state.decision),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n saved: ({ state }) => ({\n kind: \"actions\",\n title: \"Remote content list saved\",\n lines: [\n `Sync setup: ${safeTerminalText(state.decision.setupName)}`,\n \"Only the included-content setting was saved.\",\n \"No files were pulled and sync state was not changed.\",\n ],\n items: [\n ...(runRoute\n ? [\n {\n id: \"continue\",\n label: continueLabel(origin),\n description: \"Start a fresh check and exact preview for this sync setup.\",\n action: \"continue\" as const,\n },\n ]\n : []),\n { id: \"done\", label: \"Done\", action: \"done\" },\n ],\n hint: \"close\",\n }),\n },\n actions: {\n adopt: async ({ state, signal: actionSignal }) => {\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const adoption = await runCancellableTask(\n ctx,\n \"Checking and saving remote content list\u2026\",\n async (workSignal, _onCommit, onDialog) => {\n const ownedSignal = workSignal ?? signal;\n const currentConfig = await loadConfig(state.decision.setupName);\n ownedSignal.throwIfAborted();\n validateOwner();\n assertLocalSelectionCurrent(currentConfig, state.decision);\n const refusal = adoptionUnavailable(state.decision);\n if (refusal) throw new Error(refusal);\n if (!currentConfig.include.includes(\"sessions\") && state.decision.remoteInclude.includes(\"sessions\")) {\n onDialog?.(true);\n let acknowledged: boolean;\n try {\n acknowledged = await ctx.ui.confirm(\n \"Use a content list that includes session conversations?\",\n \"Session JSONL may contain prompts, tool output, file paths, images, and secrets. This saves the list only; it does not pull files.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!acknowledged) return undefined;\n }\n if (\n !currentConfig.scope &&\n state.decision.remoteExclude !== undefined &&\n currentConfig.exclude === undefined\n ) {\n onDialog?.(true);\n let confirmed: boolean;\n try {\n confirmed = await ctx.ui.confirm(\n \"Adopt excluded paths?\",\n \"This upgrades settings to version 6 / snapshots to version 4. Older clients must refuse them. Both content lists are saved; no files transfer and old history is not erased.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!confirmed) return undefined;\n }\n return runWithOptionalStateAccess(options, async () => {\n const loaded = await loadAdoptionReview(state.decision, ownedSignal, factory, validateOwner);\n ownedSignal.throwIfAborted();\n validateOwner();\n await revalidateAndAdopt(loaded, state.decision, ownedSignal, validateOwner);\n return loaded;\n });\n },\n {\n signal,\n isCurrent,\n cancelAcrossDialogs: true,\n cancelledMessage: \"Remote content-list adoption cancelled.\",\n },\n );\n if (signal.aborted || adoption.kind === \"closed\") return { kind: \"close\" as const };\n if (adoption.kind === \"cancelled\" || !adoption.value) return { kind: \"stay\" as const };\n validateOwner();\n options.onSelectionResolved?.();\n continuationFingerprint = syncCheckConfigFingerprint({\n ...adoption.value.config,\n include: [...state.decision.remoteInclude],\n exclude: adoptedExclude(state.decision),\n ...(adoption.value.config.scope\n ? { reinclude: [...(state.decision.remoteDirectory?.reinclude ?? [])] }\n : {}),\n });\n flowState = { decision: state.decision, saved: true };\n return { kind: \"to\" as const, screen: \"saved\" as const };\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not save the remote content list: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n keep: async ({ state, signal: actionSignal }) => {\n if (!runRoute) {\n ctx.ui.notify(\"The reviewed update-remote route is unavailable.\", \"error\");\n return { kind: \"stay\" as const };\n }\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n assertLocalSelectionCurrent(latest, state.decision);\n const result = await runCancellableOperation(\n ctx,\n \"Preparing this device's push preview\u2026\",\n \"push --force\",\n runRoute,\n {\n commitAware: true,\n cancelledMessage: \"Push preparation cancelled; no remote files were changed.\",\n target: state.decision.setupName,\n signal,\n },\n );\n return handleNestedRouteResult(result, \"push\");\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not prepare the remote update: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n continue: async ({ state, signal: actionSignal }) => {\n if (!runRoute || !continuationFingerprint) return { kind: \"stay\" as const };\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n if (syncCheckConfigFingerprint(latest) !== continuationFingerprint) {\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(state.decision.setupName)}\u201D changed after the remote content list was saved.`,\n );\n }\n const result = await runCancellableOperation(ctx, continueBusyLabel(origin), route, runRoute, {\n commitAware: true,\n cancelledMessage: continuationCancelledMessage(route),\n target: state.decision.setupName,\n signal,\n });\n return handleNestedRouteResult(result, route);\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n ctx.ui.notify(`Could not continue: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n cancel: async () => ({ kind: \"back\" }),\n done: async () => {\n nextResult = { kind: \"done\" };\n return { kind: \"close\" };\n },\n },\n });\n\n function handleNestedRouteResult(\n result: Awaited<ReturnType<typeof runCancellableOperation>>,\n nestedRoute: \"sync\" | \"pull\" | \"push\",\n ) {\n if (result.kind === \"completed\" && result.outcome === \"applied\") {\n options.onSelectionResolved?.();\n }\n if (result.kind === \"closed\") {\n nextResult = { kind: \"closed\" };\n return { kind: \"close\" as const };\n }\n if (\n result.kind === \"cancelled\" ||\n (result.kind === \"completed\" && result.outcome === \"cancelled\") ||\n result.kind === \"failed\"\n ) {\n return { kind: \"stay\" as const };\n }\n nextResult = { kind: \"route-result\", result, route: nestedRoute };\n return { kind: \"close\" as const };\n }\n\n const menuResult = await runMenu(ctx, menu, {\n getState: () => flowState,\n signal: sessionSignal,\n isCurrent,\n onError: (_menuCtx, error) => ctx.ui.notify(errorMessage(error), \"error\"),\n });\n if (!isCurrent() || menuResult.kind === \"stale\") return { kind: \"stale\" };\n if (refreshRequested) return { kind: \"refresh\" };\n if (nextResult) return nextResult;\n if (menuResult.kind === \"closed\") {\n return menuResult.reason === \"back\" ? { kind: \"back\" } : { kind: \"closed\" };\n }\n return { kind: \"closed\" };\n}\n\ninterface AdoptionReview {\n config: AnySyncConfig;\n backend: SyncBackend;\n reviewedHead: RemoteHead;\n}\n\nasync function loadAdoptionReview(\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<AdoptionReview> {\n const config = await loadConfig(decision.setupName);\n throwIfAborted(signal);\n validateOwner();\n assertLocalSelectionCurrent(config, decision);\n const backend = await factory(config);\n throwIfAborted(signal);\n validateOwner();\n const reviewedHead = await backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!reviewedHead) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const snapshot = await readSnapshotForHead(backend, reviewedHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const state = inspectRemoteSelection(config.include, snapshot, config.exclude, config);\n if (\n state.kind !== \"different\" ||\n !sameSyncInclude(state.include, decision.remoteInclude) ||\n !sameSyncExclude(state.exclude, decision.remoteExclude) ||\n !matchesRemoteDirectory(state, decision)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n return { config, backend, reviewedHead };\n}\n\nasync function revalidateAndAdopt(\n review: AdoptionReview,\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n validateOwner: () => void,\n) {\n const currentHead = await review.backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!currentHead || !review.backend.sameRevision(review.reviewedHead.revision, currentHead.revision)) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const currentSnapshot = await readSnapshotForHead(review.backend, currentHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const currentState = inspectRemoteSelection(\n review.config.include,\n currentSnapshot,\n review.config.exclude,\n review.config,\n );\n if (\n currentState.kind !== \"different\" ||\n !sameSyncInclude(currentState.include, decision.remoteInclude) ||\n !sameSyncExclude(currentState.exclude, decision.remoteExclude) ||\n !matchesRemoteDirectory(currentState, decision)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n await updateSyncSetup(\n decision.setupName,\n (setup) => {\n validateOwner();\n const refusal = adoptionUnavailable(decision);\n if (refusal) throw new Error(refusal);\n const exclude = adoptedExclude(decision);\n if (setup.sync.scope === \"agent-directory\") {\n return {\n ...setup,\n sync: {\n ...setup.sync,\n exclude,\n reinclude: [...(decision.remoteDirectory?.reinclude ?? [])],\n sessions: decision.remoteInclude.includes(\"sessions\"),\n },\n };\n }\n return {\n ...setup,\n sync: { ...setup.sync, include: [...decision.remoteInclude], ...(exclude === undefined ? {} : { exclude }) },\n };\n },\n {\n expectedConfigFingerprint: syncCheckConfigFingerprint(review.config),\n expectedInclude: decision.localInclude,\n upgradeExclude: adoptedExclude(decision) !== undefined,\n signal,\n },\n );\n}\n\nasync function inspectConfiguredRemoteSelection(\n ctx: ExtensionContext,\n setupName: string | undefined,\n signal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<\n | { kind: \"empty\"; config: AnySyncConfig }\n | { kind: \"selection\"; config: AnySyncConfig; state: RemoteSelectionState }\n | undefined\n> {\n const config = await loadConfig(setupName);\n if (signal?.aborted) return undefined;\n validateOwner();\n setSyncStatus(ctx, `checking synced content for ${safeTerminalText(config.setupName)}`, { activity: \"checking\" });\n const backend = await factory(config);\n if (signal?.aborted) return undefined;\n validateOwner();\n const head = await backend.readHead(signal);\n if (signal?.aborted) return undefined;\n validateOwner();\n if (!head) return { kind: \"empty\", config };\n const snapshot = await readSnapshotForHead(backend, head, signal);\n if (signal?.aborted) return undefined;\n validateOwner();\n return {\n kind: \"selection\",\n config,\n state: inspectRemoteSelection(config.include, snapshot, config.exclude, config),\n };\n}\n\nasync function showLegacyDiscovery(\n ctx: ExtensionContext,\n config: AnySyncConfig,\n discovered: string[],\n signal?: AbortSignal,\n) {\n const menu = defineMenu<undefined, \"choice\" | \"review\", \"back\", ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: () => ({\n kind: \"actions\",\n title: `Compare synced content \u00B7 ${safeTerminalText(config.setupName)}`,\n lines: [\n \"This legacy snapshot has no portable synced-content list.\",\n \"Discovered paths are partial and read-only; preserved files may not have been selected.\",\n ],\n items: [\n { id: \"review\", label: \"Review discovered paths\", to: \"review\" },\n { id: \"back\", label: \"Back\", action: \"back\" },\n ],\n hint: \"close\",\n }),\n review: () => ({\n kind: \"review\",\n title: \"Partial discovery from legacy snapshot\",\n content: [\n \"Partial discovery only \u2014 not an authoritative selection.\",\n \"\",\n ...(discovered.length > 0\n ? discovered.map((item) => `Discovered: ${safeTerminalText(item)}`)\n : [\"No safe paths were discovered.\"]),\n \"\",\n \"Use Add custom path\u2026 in the local Included Content editor if needed.\",\n ].join(\"\\n\"),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n },\n actions: { back: async () => ({ kind: \"close\" }) },\n });\n await runMenu(ctx, menu, {\n getState: () => undefined,\n signal,\n isCurrent: () => !signal?.aborted,\n });\n}\n\nfunction adoptedExclude(decision: RemoteSelectionDecision) {\n return decision.remoteExclude === undefined\n ? decision.localExclude === undefined\n ? undefined\n : []\n : [...decision.remoteExclude];\n}\n\nfunction scopesDiffer(decision: RemoteSelectionDecision) {\n return decision.localDirectory?.scope !== decision.remoteDirectory?.scope;\n}\n\nfunction adoptionUnavailable(decision: RemoteSelectionDecision) {\n if (scopesDiffer(decision))\n return \"Scope differs. Configure a setup with the remote scope to join it; this location is not migrated in place.\";\n if (\n decision.remoteDirectory?.scope &&\n decision.remoteInclude.includes(\"sessions\") &&\n !decision.localInclude.includes(\"sessions\")\n )\n return \"Enable session sync explicitly in Settings before adopting these rules.\";\n}\n\nfunction matchesRemoteDirectory(\n state: Extract<RemoteSelectionState, { kind: \"different\" }>,\n decision: RemoteSelectionDecision,\n) {\n return (\n syncDirectoryPolicyKey(state) ===\n syncDirectoryPolicyKey({\n include: decision.remoteInclude,\n exclude: decision.remoteExclude,\n ...decision.remoteDirectory,\n })\n );\n}\n\nfunction directoryReviewLines(decision: RemoteSelectionDecision) {\n if (!decision.localDirectory?.scope && !decision.remoteDirectory?.scope) return [];\n const unavailable = adoptionUnavailable(decision);\n return [\n `Remote scope: ${decision.remoteDirectory?.scope ? \"Pi agent directory\" : \"selected paths or legacy\"}`,\n `This device scope: ${decision.localDirectory?.scope ? \"Pi agent directory\" : \"selected paths\"}`,\n `Remote re-included paths: ${safeList(decision.remoteDirectory?.reinclude ?? [])}`,\n `This device re-included paths: ${safeList(decision.localDirectory?.reinclude ?? [])}`,\n ...(unavailable ? [unavailable] : []),\n ];\n}\n\nfunction selectionSummaryLines(decision: RemoteSelectionDecision) {\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Sync setup: ${safeTerminalText(decision.setupName)}`,\n \"Nothing changed. Review both lists before choosing what happens next.\",\n ...directoryReviewLines(decision),\n ...excludeReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only the ordering differs; membership is the same.\"]\n : [`Remote-only paths: ${comparison.remoteOnly.length} \u00B7 Device-only paths: ${comparison.localOnly.length}`]),\n ];\n}\n\nfunction formatSelectionDifference(decision: RemoteSelectionDecision) {\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n ...directoryReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only ordering differs; both lists contain the same paths.\", \"\"]\n : []),\n \"Remote-only paths:\",\n ...(comparison.remoteOnly.length > 0\n ? comparison.remoteOnly.map((item) => `+ ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Device-only paths:\",\n ...(comparison.localOnly.length > 0\n ? comparison.localOnly.map((item) => `- ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Remote ordered list:\",\n ...(decision.remoteInclude.length > 0\n ? decision.remoteInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"This device's ordered list:\",\n ...(decision.localInclude.length > 0\n ? decision.localInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n ...excludeReviewLines(decision),\n \"Using the remote list saves settings only and does not pull files.\",\n ].join(\"\\n\");\n}\n\nfunction formatRemoteSelectionSummary(decision: RemoteSelectionDecision) {\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Synced content for \u201C${safeTerminalText(decision.setupName)}\u201D differs from this device.`,\n `Remote-only: ${safeList(comparison.remoteOnly)}`,\n `Device-only: ${safeList(comparison.localOnly)}`,\n ...directoryReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\n \"Only ordering differs.\",\n `Remote order: ${safeList(decision.remoteInclude)}`,\n `Device order: ${safeList(decision.localInclude)}`,\n ]\n : []),\n ...excludeReviewLines(decision),\n \"Run /sync in TUI to choose a content list; RPC review is read-only.\",\n ].join(\"\\n\");\n}\n\nfunction excludeReviewLines(decision: RemoteSelectionDecision) {\n if (decision.localExclude === undefined && decision.remoteExclude === undefined) return [];\n return [\n `Remote excluded paths: ${safeList(decision.remoteExclude ?? [])}`,\n `This device excluded paths: ${safeList(decision.localExclude ?? [])}`,\n \"Removed exclusions can expose or replace content; old history is not erased.\",\n ];\n}\n\nfunction formatLegacySummary(config: AnySyncConfig, discovered: readonly string[]) {\n return `Remote snapshot for \u201C${safeTerminalText(config.setupName)}\u201D has no portable synced-content list; ${discovered.length} safe path${discovered.length === 1 ? \" was\" : \"s were\"} discovered, but the result is partial and read-only.`;\n}\n\nfunction decisionFromState(\n config: AnySyncConfig,\n state: Extract<RemoteSelectionState, { kind: \"different\" }>,\n): RemoteSelectionDecision {\n return {\n setupName: config.setupName,\n configIdentity: syncConfigReviewFingerprint(config),\n localInclude: [...config.include],\n remoteInclude: [...state.include],\n ...(config.exclude === undefined ? {} : { localExclude: [...config.exclude] }),\n ...(state.exclude === undefined ? {} : { remoteExclude: [...state.exclude] }),\n ...(config.scope ? { localDirectory: { scope: config.scope, reinclude: config.reinclude } } : {}),\n ...(state.scope ? { remoteDirectory: { scope: state.scope, reinclude: state.reinclude } } : {}),\n };\n}\n\nfunction assertLocalSelectionCurrent(config: AnySyncConfig, decision: RemoteSelectionDecision) {\n if (\n syncConfigReviewFingerprint(config) === decision.configIdentity &&\n sameSyncInclude(config.include, decision.localInclude) &&\n sameSyncExclude(config.exclude, decision.localExclude) &&\n syncDirectoryPolicyKey(config) ===\n syncDirectoryPolicyKey({\n include: decision.localInclude,\n exclude: decision.localExclude,\n ...decision.localDirectory,\n })\n ) {\n return;\n }\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(config.setupName)}\u201D changed while the comparison was open.`,\n );\n}\n\nfunction continueLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Continue Pull now\u2026\";\n if (origin === \"push\") return \"Continue Push now\u2026\";\n return \"Continue Sync now\u2026\";\n}\n\nfunction continueBusyLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Checking remote changes\u2026\";\n if (origin === \"push\") return \"Preparing push preview\u2026\";\n return \"Checking current sync setup\u2026\";\n}\n\nfunction continuationCancelledMessage(route: \"sync\" | \"pull\" | \"push\") {\n if (route === \"pull\") return \"Pull check cancelled; no local files were changed.\";\n if (route === \"push\") return \"Push preparation cancelled; no remote files were changed.\";\n return \"Sync check cancelled; no settings or files were changed.\";\n}\n\nfunction safeList(values: readonly string[]) {\n return values.length > 0 ? values.map(safeTerminalText).join(\", \") : \"none\";\n}\n\nclass StaleRemoteSelectionReviewError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"StaleRemoteSelectionReviewError\";\n }\n}\n\nfunction isStaleReviewError(error: unknown) {\n return error instanceof StaleRemoteSelectionReviewError || error instanceof SyncSetupReviewChangedError;\n}\n\nfunction runWithOptionalStateAccess<T>(\n options: Pick<RemoteSelectionReviewOptions, \"withStateAccess\">,\n task: () => Promise<T>,\n) {\n return options.withStateAccess ? options.withStateAccess(task) : task();\n}\n\nfunction isReviewOwnerCurrent(validateOwner: () => void) {\n try {\n validateOwner();\n return true;\n } catch {\n return false;\n }\n}\n\nfunction combineSignals(sessionSignal: AbortSignal | undefined, actionSignal: AbortSignal) {\n return sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;\n}\n", "export type * from \"@narumitw/pi-sync-daemon/engine/backends/backend-factory\";\nexport { createSyncBackend } from \"@narumitw/pi-sync-daemon/engine/backends/backend-factory\";\n", "export type * from \"@narumitw/pi-sync-daemon/engine/sync/remote-snapshot\";\nexport {\n formatRemoteSelectionStatus,\n readRemoteSnapshot,\n readSnapshotForHead,\n requireCompatibleRemoteSelection,\n} from \"@narumitw/pi-sync-daemon/engine/sync/remote-snapshot\";\n", "import { BorderedLoader, type ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { isKeyRelease, Key, matchesKey, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport { formatInteractionHints, runCustomInteraction } from \"@narumitw/pi-tui-kit\";\nimport type { SetupPullOutcome } from \"../sync/setup-switch.js\";\nimport type { SyncDecision } from \"../sync/sync-decision.js\";\nimport type { RemoteSelectionDecision } from \"../sync/sync-policy.js\";\n\nexport type RunRouteResult =\n | { kind: \"completed\"; outcome?: SetupPullOutcome }\n | { kind: \"decision-required\"; decision: SyncDecision }\n | { kind: \"remote-selection-required\"; decision: RemoteSelectionDecision }\n | { kind: \"failed\" };\n\nexport type RunRoute = (\n route: string,\n signal?: AbortSignal,\n onCommit?: () => void,\n target?: string,\n onDialog?: (active: boolean) => void,\n retryRefusal?: boolean,\n) => Promise<RunRouteResult | undefined>;\n\nexport type CancellableOperationResult = RunRouteResult | { kind: \"closed\" } | { kind: \"cancelled\" };\n\ninterface CancellableOperationOptions {\n commitAware?: boolean;\n cancelAcrossDialogs?: boolean;\n cancelledMessage?: string | null;\n target?: string;\n signal?: AbortSignal;\n isCurrent?: () => boolean;\n}\n\nexport async function runCancellableOperation(\n ctx: ExtensionContext,\n message: string,\n route: string,\n runRoute: RunRoute,\n options: CancellableOperationOptions = {},\n): Promise<CancellableOperationResult> {\n const result = await runCancellableTask(\n ctx,\n message,\n (signal, onCommit, onDialog) => runRoute(route, signal, onCommit, options.target, onDialog),\n options,\n );\n return result.kind === \"completed\" ? (result.value ?? { kind: \"failed\" }) : result;\n}\n\nexport type CancellableTaskResult<Value> =\n | { kind: \"completed\"; value: Value }\n | { kind: \"closed\" }\n | { kind: \"cancelled\" };\n\n/** Keep non-route work under the same cancellation and drain owner as transfers. */\nexport async function runCancellableTask<Value>(\n ctx: ExtensionContext,\n message: string,\n task: (\n signal: AbortSignal | undefined,\n onCommit?: () => void,\n onDialog?: (active: boolean) => void,\n ) => Promise<Value>,\n options: Omit<CancellableOperationOptions, \"target\"> = {},\n): Promise<CancellableTaskResult<Value>> {\n const {\n commitAware = false,\n cancelAcrossDialogs = false,\n cancelledMessage = \"Check cancelled; no settings or files were changed.\",\n signal,\n isCurrent = () => true,\n } = options;\n if (signal?.aborted || !isCurrent()) return { kind: \"closed\" };\n if (ctx.mode !== \"tui\") return { kind: \"completed\", value: await task(signal) };\n let commitStarted = false;\n let taskResult!: Value;\n const interaction = await runCustomInteraction<{ cancelled?: boolean; error?: unknown }, ExtensionContext>(ctx, {\n signal,\n isCurrent: () => !signal?.aborted && isCurrent(),\n create: ({ tui, theme, keybindings, signal: interactionSignal, complete }) => {\n const loader = new BorderedLoader(tui, theme, message, { cancellable: false });\n const cancelHint = formatInteractionHints(keybindings, [\n {\n keys: [...keybindings.getKeys(\"tui.select.cancel\").filter((key) => !hasControlCharacter(key)), \"ctrl+c\"],\n label: \"cancel\",\n },\n ]);\n const cancel = (data: string) => {\n // Raw terminal listeners run before Pi filters Kitty key releases.\n if (isKeyRelease(data)) return false;\n if (!matchesKey(data, Key.ctrl(\"c\")) && !keybindings.matches(data, \"tui.select.cancel\")) return false;\n if (commitStarted) {\n ctx.ui.notify(\"Applying or publishing has started and cannot be cancelled safely.\", \"warning\");\n } else complete({ cancelled: true });\n return true;\n };\n // Pi dialogs replace this loader and restore the normal editor. Defer\n // ordinary keys while they are open; retain raw cancellation afterward.\n // Ctrl+C remains the root flow's hard-cancel path regardless of focus.\n let activeDialogs = 0;\n const unsubscribe = cancelAcrossDialogs\n ? ctx.ui.onTerminalInput((data) => {\n if (isKeyRelease(data)) return;\n if (activeDialogs > 0 && !matchesKey(data, Key.ctrl(\"c\"))) return;\n return cancel(data) ? { consume: true } : undefined;\n })\n : undefined;\n let pendingTask: Promise<Value>;\n try {\n pendingTask = task(\n interactionSignal,\n commitAware ? () => (commitStarted = true) : undefined,\n cancelAcrossDialogs\n ? (active) => {\n activeDialogs += active ? 1 : -1;\n }\n : undefined,\n );\n } catch (error) {\n unsubscribe?.();\n loader.dispose();\n throw error;\n }\n const operation = pendingTask.then(\n (result) => {\n taskResult = result;\n complete({});\n },\n (error: unknown) => complete({ error }),\n );\n return {\n render(width: number) {\n if (width <= 0) return [];\n const safeWidth = Math.max(1, width);\n const lines = loader.render(safeWidth);\n const bottomBorder = lines.at(-1);\n return [\n ...lines.slice(0, -1),\n truncateToWidth(theme.fg(\"dim\", cancelHint), safeWidth, \"\"),\n ...(bottomBorder === undefined ? [] : [bottomBorder]),\n ];\n },\n invalidate: () => loader.invalidate(),\n handleInput: cancel,\n dispose() {\n unsubscribe?.();\n loader.dispose();\n },\n waitForPending: () => operation,\n };\n },\n });\n if (interaction.kind === \"error\") throw interaction.error;\n if (interaction.kind !== \"completed\") return { kind: \"closed\" };\n if (interaction.value.cancelled) {\n if (cancelledMessage) ctx.ui.notify(cancelledMessage, \"info\");\n return { kind: \"cancelled\" };\n }\n if (interaction.value.error) throw interaction.value.error;\n return { kind: \"completed\", value: taskResult };\n}\n\nfunction hasControlCharacter(value: string) {\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Unsafe key labels must be omitted.\n return /[\\u0000-\\u001f\\u007f-\\u009f]/u.test(value);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACApC,SAAS,yBAAyB;;;ACAlC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACNP,SAAS,sBAA6C;AACtD,SAAS,cAAc,KAAK,YAAY,uBAAuB;AAC/D,SAAS,wBAAwB,4BAA4B;AA+B7D,eAAsB,wBACpB,KACA,SACA,OACA,UACA,UAAuC,CAAC,GACH;AACrC,QAAM,SAAS,MAAM;AAAA,IACnB;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,UAAU,aAAa,SAAS,OAAO,QAAQ,UAAU,QAAQ,QAAQ,QAAQ;AAAA,IAC1F;AAAA,EACF;AACA,SAAO,OAAO,SAAS,cAAe,OAAO,SAAS,EAAE,MAAM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,OAAQ,QAAO;AAC7B,SAAO;AACT;AAEA,SAAS,SAAS,QAA2B;AAC3C,SAAO,OAAO,SAAS,IAAI,OAAO,IAAI,gBAAgB,EAAE,KAAK,IAAI,IAAI;AACvE;AAEA,IAAM,kCAAN,cAA8C,MAAM;AAAA,EAClD,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEA,SAAS,mBAAmB,OAAgB;AAC1C,SAAO,iBAAiB,mCAAmC,iBAAiB;AAC9E;AAEA,SAAS,2BACP,SACA,MACA;AACA,SAAO,QAAQ,kBAAkB,QAAQ,gBAAgB,IAAI,IAAI,KAAK;AACxE;AAEA,SAAS,qBAAqB,eAA2B;AACvD,MAAI;AACF,kBAAc;AACd,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,eAAe,eAAwC,cAA2B;AACzF,SAAO,gBAAgB,YAAY,IAAI,CAAC,eAAe,YAAY,CAAC,IAAI;AAC1E;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// @generated by scripts/build-runtime.mjs; do not edit.
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
|
-
import {
|
|
4
|
-
loadConfig,
|
|
5
|
-
syncConfigReviewIdentity,
|
|
6
|
-
syncSetupReviewIdentity
|
|
7
|
-
} from "./chunk-277VHM2P.ts";
|
|
8
3
|
import {
|
|
9
4
|
normalizeOnSwitch
|
|
10
5
|
} from "./chunk-OA4NZLSL.ts";
|
|
@@ -18,6 +13,11 @@ import {
|
|
|
18
13
|
import {
|
|
19
14
|
throwIfAborted
|
|
20
15
|
} from "./chunk-S3R3W3KF.ts";
|
|
16
|
+
import {
|
|
17
|
+
loadConfig,
|
|
18
|
+
syncConfigReviewIdentity,
|
|
19
|
+
syncSetupReviewIdentity
|
|
20
|
+
} from "./chunk-277VHM2P.ts";
|
|
21
21
|
import {
|
|
22
22
|
SetupPullRequiresUiError
|
|
23
23
|
} from "./chunk-ZIL6PW5L.ts";
|
|
@@ -128,4 +128,4 @@ export {
|
|
|
128
128
|
saveOnSwitch,
|
|
129
129
|
useSyncSetup
|
|
130
130
|
};
|
|
131
|
-
//# sourceMappingURL=chunk-
|
|
131
|
+
//# sourceMappingURL=chunk-PJMM75W5.ts.map
|
|
@@ -9,13 +9,14 @@ import {
|
|
|
9
9
|
} from "./chunk-277VHM2P.ts";
|
|
10
10
|
import {
|
|
11
11
|
setSyncStatus
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-H7VOTY5N.ts";
|
|
13
|
+
import {
|
|
14
|
+
sameSyncInclude,
|
|
15
|
+
syncDirectoryPolicyKey
|
|
16
|
+
} from "./chunk-ZVGRZD4C.ts";
|
|
13
17
|
import {
|
|
14
18
|
safeTerminalText
|
|
15
19
|
} from "./chunk-2JNFEZ3V.ts";
|
|
16
|
-
import {
|
|
17
|
-
sameSyncInclude
|
|
18
|
-
} from "./chunk-V4AMI3VL.ts";
|
|
19
20
|
|
|
20
21
|
// src/state/sync-state-store.ts
|
|
21
22
|
import {
|
|
@@ -33,7 +34,11 @@ import {
|
|
|
33
34
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
34
35
|
var WIDGET_KEY = "sync:attention";
|
|
35
36
|
function syncAttentionMatchesConfig(attention, config) {
|
|
36
|
-
return attention.decision.setupName === config.setupName && attention.decision.configIdentity === syncConfigReviewFingerprint(config) && sameSyncInclude(attention.decision.localInclude, config.include) && sameSyncExclude(attention.decision.localExclude, config.exclude)
|
|
37
|
+
return attention.decision.setupName === config.setupName && attention.decision.configIdentity === syncConfigReviewFingerprint(config) && sameSyncInclude(attention.decision.localInclude, config.include) && sameSyncExclude(attention.decision.localExclude, config.exclude) && syncDirectoryPolicyKey(config) === syncDirectoryPolicyKey({
|
|
38
|
+
include: attention.decision.localInclude,
|
|
39
|
+
exclude: attention.decision.localExclude,
|
|
40
|
+
...attention.decision.localDirectory
|
|
41
|
+
});
|
|
37
42
|
}
|
|
38
43
|
function createSyncAttentionController() {
|
|
39
44
|
let state;
|
|
@@ -179,4 +184,4 @@ export {
|
|
|
179
184
|
observationMatchesConfig,
|
|
180
185
|
observationSummary
|
|
181
186
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-S7F4FOAS.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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,g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i-sync-daemon/engine/settings/config-file";
|
|
23
23
|
|
|
24
|
+
// src/sync/sync-error-guidance.ts
|
|
25
|
+
import { syncErrorGuidance } from "@narumitw/pi-sync-daemon/engine/sync/sync-error-guidance";
|
|
26
|
+
|
|
24
27
|
export {
|
|
25
28
|
activeLocalConfigPath,
|
|
26
29
|
createLocalConfigDocument,
|
|
27
|
-
localConfigPath
|
|
30
|
+
localConfigPath,
|
|
31
|
+
syncErrorGuidance
|
|
28
32
|
};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-YQSFJLJ3.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/settings/config-file.ts"],
|
|
4
|
-
"sourcesContent": ["export type * from \"@narumitw/pi-sync-daemon/engine/settings/config-file\";\nexport {\n activeLocalConfigPath,\n consumeLocalConfigMigrationNotice,\n createLocalConfigDocument,\n legacyLocalConfigPath,\n localConfigPath,\n quarantineAndRemoveConfigIfMatches,\n readActiveLocalConfigDocumentForRepair,\n readMigratingLocalConfigDocument,\n replaceLocalConfigDocument,\n updateLocalConfigDocument,\n withConfigFilePublicationForTest,\n withConfigPublicationReadyHookForTest,\n withConfigQuarantinedHookForTest,\n withConfigReplacementInstalledHookForTest,\n withLocalConfigFileLock,\n withMissingConfigReadProbeHookForTest,\n} from \"@narumitw/pi-sync-daemon/engine/settings/config-file\";\n"],
|
|
5
|
-
"mappings": ";;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
|
3
|
+
"sources": ["../../src/settings/config-file.ts", "../../src/sync/sync-error-guidance.ts"],
|
|
4
|
+
"sourcesContent": ["export type * from \"@narumitw/pi-sync-daemon/engine/settings/config-file\";\nexport {\n activeLocalConfigPath,\n consumeLocalConfigMigrationNotice,\n createLocalConfigDocument,\n legacyLocalConfigPath,\n localConfigPath,\n quarantineAndRemoveConfigIfMatches,\n readActiveLocalConfigDocumentForRepair,\n readMigratingLocalConfigDocument,\n replaceLocalConfigDocument,\n updateLocalConfigDocument,\n withConfigFilePublicationForTest,\n withConfigPublicationReadyHookForTest,\n withConfigQuarantinedHookForTest,\n withConfigReplacementInstalledHookForTest,\n withLocalConfigFileLock,\n withMissingConfigReadProbeHookForTest,\n} from \"@narumitw/pi-sync-daemon/engine/settings/config-file\";\n", "export type * from \"@narumitw/pi-sync-daemon/engine/sync/sync-error-guidance\";\nexport { syncErrorGuidance } from \"@narumitw/pi-sync-daemon/engine/sync/sync-error-guidance\";\n"],
|
|
5
|
+
"mappings": ";;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACjBP,SAAS,yBAAyB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|