@narumitw/pi-sync 0.64.0 → 0.65.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 +10 -0
- package/README.md +76 -7
- package/dist/chunks/{chunk-CKUGCBHP.ts → chunk-AYGMIMCV.ts} +2 -2
- package/dist/chunks/chunk-AYGMIMCV.ts.map +7 -0
- package/dist/chunks/{chunk-F3VODLVQ.ts → chunk-IOM6E5FW.ts} +3 -3
- package/dist/chunks/{chunk-RW44KNFD.ts → chunk-JQ5BAWW2.ts} +182 -12
- package/dist/chunks/chunk-JQ5BAWW2.ts.map +7 -0
- package/dist/chunks/{chunk-NDEZ52SS.ts → chunk-OBVJTKVY.ts} +5 -5
- package/dist/chunks/{chunk-TJ7YNITN.ts → chunk-OWEOZZZE.ts} +2 -2
- package/dist/chunks/{chunk-VPSC7BXM.ts → chunk-SZJOUVCL.ts} +2 -2
- package/dist/chunks/{chunk-YT6PDRMM.ts → chunk-WJQ4TGN5.ts} +17 -17
- package/dist/chunks/chunk-WJQ4TGN5.ts.map +7 -0
- package/dist/chunks/{chunk-4VKWHVUO.ts → chunk-XUZV4OGI.ts} +3 -2
- package/dist/chunks/{chunk-4VKWHVUO.ts.map → chunk-XUZV4OGI.ts.map} +2 -2
- package/dist/chunks/{command-handler-N45GY7AV.ts → command-handler-YZ4DXQ7N.ts} +49 -10
- package/dist/chunks/command-handler-YZ4DXQ7N.ts.map +7 -0
- package/dist/chunks/{conflict-review-5E4M44BA.ts → conflict-review-J7L7S4AR.ts} +2 -2
- package/dist/chunks/{manager-result-dispatcher-FKW55L7I.ts → manager-result-dispatcher-XB75YLEG.ts} +4 -4
- package/dist/chunks/{manager-ui-EV23DPZQ.ts → manager-ui-RGA26Z6G.ts} +40 -38
- package/dist/chunks/manager-ui-RGA26Z6G.ts.map +7 -0
- package/dist/chunks/{merge-review-6YSLSMGS.ts → merge-review-AAC674C6.ts} +3 -3
- package/dist/chunks/{remote-selection-ui-N4NMWFT2.ts → remote-selection-ui-WVMET5RI.ts} +3 -3
- package/dist/chunks/{setup-switch-HY7K3442.ts → setup-switch-644T6KHG.ts} +3 -3
- package/dist/chunks/{setup-wizard-LEKDQ3HK.ts → setup-wizard-YP2KF2WQ.ts} +5 -5
- package/dist/chunks/{sync-inspection-OS2LVOLV.ts → sync-inspection-NBBTSMKR.ts} +2 -2
- package/dist/chunks/{sync-operations-D3MDJUQQ.ts → sync-operations-AIEM2KL2.ts} +2 -2
- package/dist/daemon/dist/client.js +125 -287
- package/dist/daemon/dist/daemon-recovery.js +85 -2
- package/dist/daemon/dist/daemon-startup.js +257 -0
- package/dist/daemon/dist/engine/backends/git/git-backend.js +10 -1
- package/dist/daemon/dist/engine/backends/s3/s3-backend.js +20 -9
- package/dist/daemon/dist/engine/backends/sync-backend.js +16 -0
- package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +19 -6
- package/dist/daemon/dist/engine/sync/directional-action.js +124 -0
- package/dist/daemon/dist/engine/sync/remote-snapshot.js +3 -1
- package/dist/daemon/dist/engine/sync/sync-errors.js +20 -0
- package/dist/daemon/dist/engine/sync/sync-local.js +56 -3
- package/dist/daemon/dist/engine/sync/sync-mutations.js +300 -334
- package/dist/daemon/dist/engine/sync/sync-queries.js +2 -1
- package/dist/daemon/dist/engine/sync/sync-rollback.js +198 -0
- package/dist/daemon/dist/engine/sync/transfer-freshness.js +11 -5
- package/dist/daemon/dist/engine-service.js +68 -0
- package/dist/daemon/dist/foreground-queue-outcome.js +9 -0
- package/dist/daemon/dist/monitor.js +1 -0
- package/dist/daemon/dist/server.js +76 -11
- package/dist/daemon/dist/service-host.js +56 -8
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +6 -6
- package/docs/daemon-migration.md +3 -6
- package/package.json +2 -2
- package/src/commands/command-execution.ts +56 -2
- package/src/commands/command-handler.ts +2 -0
- package/src/commands/command.ts +2 -1
- package/src/daemon/directional-recovery.ts +103 -0
- package/src/daemon/pi-client.ts +112 -9
- package/src/ui/cancellable-operation.ts +5 -2
- package/src/ui/manager-state.ts +2 -2
- package/src/ui/manager-ui.ts +29 -24
- package/src/ui/merge-review.ts +8 -9
- package/src/ui/sync-confirmation.ts +7 -7
- package/dist/chunks/chunk-CKUGCBHP.ts.map +0 -7
- package/dist/chunks/chunk-RW44KNFD.ts.map +0 -7
- package/dist/chunks/chunk-YT6PDRMM.ts.map +0 -7
- package/dist/chunks/command-handler-N45GY7AV.ts.map +0 -7
- package/dist/chunks/manager-ui-EV23DPZQ.ts.map +0 -7
- /package/dist/chunks/{chunk-F3VODLVQ.ts.map → chunk-IOM6E5FW.ts.map} +0 -0
- /package/dist/chunks/{chunk-NDEZ52SS.ts.map → chunk-OBVJTKVY.ts.map} +0 -0
- /package/dist/chunks/{chunk-TJ7YNITN.ts.map → chunk-OWEOZZZE.ts.map} +0 -0
- /package/dist/chunks/{chunk-VPSC7BXM.ts.map → chunk-SZJOUVCL.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-5E4M44BA.ts.map → conflict-review-J7L7S4AR.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-FKW55L7I.ts.map → manager-result-dispatcher-XB75YLEG.ts.map} +0 -0
- /package/dist/chunks/{merge-review-6YSLSMGS.ts.map → merge-review-AAC674C6.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-N4NMWFT2.ts.map → remote-selection-ui-WVMET5RI.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-HY7K3442.ts.map → setup-switch-644T6KHG.ts.map} +0 -0
- /package/dist/chunks/{setup-wizard-LEKDQ3HK.ts.map → setup-wizard-YP2KF2WQ.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-OS2LVOLV.ts.map → sync-inspection-NBBTSMKR.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-D3MDJUQQ.ts.map → sync-operations-AIEM2KL2.ts.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ui/sync-behavior.ts", "../../src/commands/command.ts"],
|
|
4
|
-
"sourcesContent": ["export const AUTOMATIC_SYNC_DESCRIPTION =\n \"This setup: check remote state once at startup in TUI/RPC. At shutdown, push all selected content only when sessions are included; reload skips that push. Saves apply to subsequent operations; a new check waits for the next session start. This does not enable startup transfer.\";\n\nexport const STARTUP_TRANSFER_DESCRIPTION =\n \"This setup: separate opt-in for one idle startup transfer in TUI/RPC. Requires an accepted baseline, matching remote included paths, and conditional or lease-protected publication (Git, verified WebDAV, or R2/S3 with verified conditional writes). May upload, replace, or remove selected files. Never reloads resources. Enabling applies next session start; opening Settings cancels pending work. Completed transfers are not undone.\";\n\nexport function startupTransferSummary(config: {\n automaticTransfer?: boolean;\n backend: { type: \"s3\" | \"git\" | \"webdav\" };\n}) {\n if (!config.automaticTransfer) return \"Off\";\n return config.backend.type === \"s3\"\n ? \"On (next idle startup; R2/S3 conditional-write verification required)\"\n : \"On (next idle startup; baseline and remote policy checks required)\";\n}\n", "import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { AUTOMATIC_SYNC_DESCRIPTION, STARTUP_TRANSFER_DESCRIPTION } from \"../ui/sync-behavior.js\";\nimport type { CommandArgumentCompletion, CommandOptions } from \"./command-types.js\";\n\nconst YES_FLAG_COMPLETIONS: readonly CommandArgumentCompletion[] = [\n { value: \"--yes\", label: \"--yes\", description: \"Skip confirmation prompts\" },\n { value: \"-y\", label: \"-y\", description: \"Skip confirmation prompts\" },\n];\nexport const SYNC_COMMANDS = [\n { name: \"help\", description: \"Show command usage\" },\n { name: \"use\", description: \"Switch the current sync setup\", usageSuffix: \" <setup>\" },\n { name: \"init\", description: \"Create local config template\" },\n { name: \"config\", description: \"Show resolved configuration\" },\n { name: \"files\", description: \"Choose included content\" },\n { name: \"status\", description: \"Show sync status\" },\n { name: \"diff\", description: \"Show local/remote diff\" },\n { name: \"conflicts\", description: \"Review private unresolved conflict groups\" },\n { name: \"doctor\", description: \"Check config, secrets, and lock state\" },\n {\n name: \"daemon\",\n description: \"Review service handover and unattended permission\",\n usageSuffix: \" [status|recover|handover|allow-after-exit|revoke-after-exit]\",\n },\n { name: \"push\", description: \"Upload local settings\" },\n { name: \"pull\", description: \"Apply remote settings\" },\n { name: \"sync\", description: \"Push or pull as needed\" },\n { name: \"history\", description: \"Show recent remote snapshots\" },\n { name: \"rollback\", description: \"Apply a previous snapshot\", usageSuffix: \" <snapshot>\" },\n { name: \"migrate-state\", description: \"Move legacy state into pi-sync/\" },\n { name: \"unlock\", description: \"Remove a stale local lock\", usageSuffix: \" --stale\" },\n] as const;\n\nexport type SyncCommandName = (typeof SYNC_COMMANDS)[number][\"name\"];\n\nconst SYNC_COMMAND_COMPLETIONS: readonly CommandArgumentCompletion[] = SYNC_COMMANDS.map(({ name, description }) => ({\n value: name,\n label: name,\n description,\n}));\nlet setupCompletionNames: string[] = [];\n\nexport function setSyncSetupCompletions(names: readonly string[]) {\n setupCompletionNames = [...new Set(names)].sort((left, right) => left.localeCompare(right));\n}\nconst SETUP_FLAG_COMPLETION = {\n value: \"--setup\",\n label: \"--setup\",\n description: \"Address a sync setup without switching\",\n} as const;\nconst SYNC_FLAG_COMPLETIONS: Record<string, readonly CommandArgumentCompletion[]> = {\n config: [SETUP_FLAG_COMPLETION],\n files: [SETUP_FLAG_COMPLETION],\n status: [SETUP_FLAG_COMPLETION],\n diff: [SETUP_FLAG_COMPLETION],\n conflicts: [SETUP_FLAG_COMPLETION],\n doctor: [SETUP_FLAG_COMPLETION],\n push: [\n ...YES_FLAG_COMPLETIONS,\n { value: \"--force\", label: \"--force\", description: \"Overwrite visible remote changes\" },\n SETUP_FLAG_COMPLETION,\n ],\n pull: [\n ...YES_FLAG_COMPLETIONS,\n { value: \"--force\", label: \"--force\", description: \"Overwrite local changes\" },\n SETUP_FLAG_COMPLETION,\n ],\n sync: [\n ...YES_FLAG_COMPLETIONS,\n { value: \"--force\", label: \"--force\", description: \"Resolve conflicts by forcing action\" },\n SETUP_FLAG_COMPLETION,\n ],\n history: [SETUP_FLAG_COMPLETION],\n rollback: [...YES_FLAG_COMPLETIONS, SETUP_FLAG_COMPLETION],\n \"migrate-state\": YES_FLAG_COMPLETIONS,\n unlock: [{ value: \"--stale\", label: \"--stale\", description: \"Remove only a stale lock\" }],\n};\n\nexport function splitArgs(input: string) {\n return input.match(/(?:[^\\s\"']+|\"[^\"]*\"|'[^']*')+/g)?.map((arg) => arg.replace(/^['\"]|['\"]$/g, \"\")) ?? [];\n}\n\nexport function parseOptions(args: string[]): CommandOptions {\n const values: string[] = [];\n let yes = false;\n let force = false;\n let stale = false;\n let setup: string | undefined;\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n if (arg === \"--yes\" || arg === \"-y\") yes = true;\n else if (arg === \"--force\") force = true;\n else if (arg === \"--stale\") stale = true;\n else if (arg === \"--setup\") {\n const name = args[index + 1];\n if (!name || name.startsWith(\"-\")) throw new Error(\"--setup requires a sync setup name.\");\n if (setup !== undefined) throw new Error(\"--setup may be provided only once.\");\n setup = name;\n index += 1;\n } else if (arg.startsWith(\"-\")) {\n throw new Error(`Unknown sync option: ${arg}`);\n } else values.push(arg);\n }\n return {\n yes,\n force,\n stale,\n silent: false,\n reload: true,\n auto: false,\n ...(setup === undefined ? {} : { setup }),\n args: values,\n };\n}\n\nexport function validateCommandOptions(command: string, options: CommandOptions) {\n const setupAllowed = new Set([\n \"config\",\n \"files\",\n \"status\",\n \"diff\",\n \"conflicts\",\n \"doctor\",\n \"push\",\n \"pull\",\n \"sync\",\n \"history\",\n \"rollback\",\n ]);\n if (options.setup && !setupAllowed.has(command)) {\n throw new Error(`--setup is not supported by /sync ${command}.`);\n }\n if (options.yes && ![\"push\", \"pull\", \"sync\", \"rollback\", \"migrate-state\"].includes(command)) {\n throw new Error(`Confirmation/force options are not supported by /sync ${command}.`);\n }\n if (options.force && ![\"push\", \"pull\", \"sync\", \"rollback\"].includes(command)) {\n throw new Error(`Confirmation/force options are not supported by /sync ${command}.`);\n }\n if (options.stale && command !== \"unlock\") {\n throw new Error(`--stale is not supported by /sync ${command}.`);\n }\n if (command === \"daemon\" && options.args.length <= 1) {\n const action = options.args[0];\n if (action !== undefined && !DAEMON_ACTIONS.some((value) => value === action))\n throw new Error(`Unknown daemon action: ${action}`);\n return;\n }\n const expectedValues = command === \"rollback\" || command === \"use\" ? 1 : 0;\n if (options.args.length !== expectedValues) {\n if (command === \"rollback\") throw new Error(\"Usage: /sync rollback <snapshot-id> [--yes] [--setup <name>]\");\n if (command === \"use\") throw new Error(\"Usage: /sync use <setup>\");\n throw new Error(`Unexpected argument for /sync ${command}: ${options.args.join(\" \")}`);\n }\n}\n\nconst DAEMON_ACTIONS = [\"status\", \"recover\", \"handover\", \"allow-after-exit\", \"revoke-after-exit\"] as const;\n\nexport function completeSyncArguments(argumentPrefix: string): CommandArgumentCompletion[] | null {\n const prefix = argumentPrefix.trimStart();\n if (prefix === \"\") return [...SYNC_COMMAND_COMPLETIONS];\n\n const trailingSpace = /\\s$/.test(prefix);\n const tokens = splitArgs(prefix);\n if (tokens.length === 0) return [...SYNC_COMMAND_COMPLETIONS];\n\n const [command] = tokens;\n if (tokens.length === 1 && !trailingSpace) {\n const matches = SYNC_COMMAND_COMPLETIONS.filter((item) => item.value.startsWith(command));\n return matches.length > 0 ? [...matches] : null;\n }\n\n const args = tokens.slice(1);\n if (command === \"use\") {\n if (args.length > 1 || (trailingSpace && args.length > 0)) return null;\n return completeSetupValue(prefix, trailingSpace ? \"\" : (args[0] ?? \"\"));\n }\n if (command === \"daemon\") {\n if (args.length > 1 || (trailingSpace && args.length > 0)) return null;\n const current = trailingSpace ? \"\" : (args[0] ?? \"\");\n const base = trailingSpace ? prefix : prefix.slice(0, prefix.length - current.length);\n const matches = DAEMON_ACTIONS.filter((action) => action.startsWith(current));\n return matches.length\n ? matches.map((action) => ({ value: `${base}${action}`, label: action, description: \"Daemon control\" }))\n : null;\n }\n const setupFlagIndex = args.lastIndexOf(\"--setup\");\n if (setupFlagIndex >= 0 && setupFlagIndex === args.length - (trailingSpace ? 1 : 2)) {\n const currentSetup = trailingSpace ? \"\" : (args.at(-1) ?? \"\");\n if (!currentSetup.startsWith(\"-\")) return completeSetupValue(prefix, currentSetup);\n }\n\n const flagCompletions = SYNC_FLAG_COMPLETIONS[command];\n if (!flagCompletions) return null;\n\n const completedArgs = trailingSpace ? args : args.slice(0, -1);\n const completedValues = completedArgs.filter((arg) => !arg.startsWith(\"-\"));\n if (command === \"rollback\" ? completedValues.length > 1 : completedValues.length > 0) {\n return null;\n }\n\n const current = trailingSpace ? \"\" : (args.at(-1) ?? \"\");\n if (current && !current.startsWith(\"-\")) return null;\n\n const currentRaw = trailingSpace ? \"\" : (prefix.match(/\\S+$/)?.[0] ?? \"\");\n const completionPrefix = trailingSpace ? prefix : prefix.slice(0, prefix.length - currentRaw.length);\n const matches = flagCompletions.filter((item) => item.value.startsWith(current));\n return matches.length > 0 ? matches.map((item) => ({ ...item, value: `${completionPrefix}${item.value}` })) : null;\n}\n\nfunction completeSetupValue(prefix: string, current: string) {\n const currentRaw = current ? (prefix.match(/\\S+$/u)?.[0] ?? \"\") : \"\";\n const completionPrefix = currentRaw ? prefix.slice(0, prefix.length - currentRaw.length) : prefix;\n const matches = setupCompletionNames.filter((name) => name.startsWith(current));\n return matches.length > 0\n ? matches.map((name) => ({\n value: `${completionPrefix}${name}`,\n label: name,\n description: \"Sync setup\",\n }))\n : null;\n}\n\nexport function syncMenuOptions() {\n return SYNC_COMMANDS.map(({ name, description }) => `${name} \u2014 ${description}`);\n}\n\nexport function syncCommandFromMenuOption(option: string): SyncCommandName | undefined {\n return SYNC_COMMANDS.find(({ name, description }) => option === `${name} \u2014 ${description}`)?.name;\n}\n\nexport async function resolveSyncCommand(input: string, ctx: ExtensionCommandContext) {\n const [subcommand, ...rest] = splitArgs(input);\n if (subcommand) return { subcommand, rest };\n if (!ctx.hasUI) {\n ctx.ui.notify(usage(), \"info\");\n return undefined;\n }\n\n const selectedOption = await ctx.ui.select(\"pi-sync\", syncMenuOptions());\n const selected = selectedOption ? syncCommandFromMenuOption(selectedOption) : undefined;\n if (!selected) return undefined;\n if (selected !== \"rollback\") return { subcommand: selected, rest: [] };\n\n const target = (await ctx.ui.input(\"Rollback snapshot\", \"snapshot id\"))?.trim();\n if (!target) {\n ctx.ui.notify(\"Rollback cancelled.\", \"info\");\n return undefined;\n }\n return { subcommand: selected, rest: [target] };\n}\n\nexport function usage() {\n const commands = SYNC_COMMANDS.map(\n (command) => `${command.name}${\"usageSuffix\" in command ? command.usageSuffix : \"\"}`,\n ).join(\", \");\n return [\n \"Usage: /sync <command>\",\n `Commands: ${commands}`,\n \"Daemon cleanup: /sync daemon recover reviews and stops the existing daemon. It does not start a replacement or retry a transfer.\",\n `Automatic sync: ${AUTOMATIC_SYNC_DESCRIPTION}`,\n `Startup transfer: ${STARTUP_TRANSFER_DESCRIPTION}`,\n \"Automatic transfer at startup is a separate opt-in: one conflict-free established-baseline transfer at idle in TUI/RPC, with conditional/lease publication and no resource reload.\",\n \"Continuous sync is a separate default-Off opt-in in Settings. It requires Autonomous sync and can incur recurring network/model costs. After the last Pi exits, the service closes after a 30-second grace period unless a valid /sync daemon allow-after-exit grant applies. Zero-client work still requires that separate review. Safety blocks and durable automatic request limits remain.\",\n \"Settings: use /sync init or edit storage connections and sync setups in ~/.pi/agent/pi-sync.json (or the configured Pi agent directory). Version 1 and version 2 settings are unsupported and are never rewritten.\",\n ].join(\"\\n\");\n}\n"],
|
|
5
|
-
"mappings": ";;;;AAAO,IAAM,6BACX;AAEK,IAAM,+BACX;AAEK,SAAS,uBAAuB,QAGpC;AACD,MAAI,CAAC,OAAO,kBAAmB,QAAO;AACtC,SAAO,OAAO,QAAQ,SAAS,OAC3B,0EACA;AACN;;;ACVA,IAAM,uBAA6D;AAAA,EACjE,EAAE,OAAO,SAAS,OAAO,SAAS,aAAa,4BAA4B;AAAA,EAC3E,EAAE,OAAO,MAAM,OAAO,MA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AI,aAAa,WAAY,QAAO,EAAE,YAAY,UAAU,MAAM,CAAC,EAAE;AAErE,QAAM,UAAU,MAAM,IAAI,GAAG,MAAM,qBAAqB,aAAa,IAAI,KAAK;AAC9E,MAAI,CAAC,QAAQ;AACX,QAAI,GAAG,OAAO,uBAAuB,MAAM;AAC3C,WAAO;AAAA,EACT;AACA,SAAO,EAAE,YAAY,UAAU,MAAM,CAAC,MAAM,EAAE;AAChD;AAEO,SAAS,QAAQ;AACtB,QAAM,WAAW,cAAc;AAAA,IAC7B,CAAC,YAAY,GAAG,QAAQ,IAAI,GAAG,iBAAiB,UAAU,QAAQ,cAAc,EAAE;AAAA,EACpF,EAAE,KAAK,IAAI;AACX,SAAO;AAAA,IACL;AAAA,IACA,aAAa,QAAQ;AAAA,IACrB;AAAA,IACA,mBAAmB,0BAA0B;AAAA,IAC7C,qBAAqB,4BAA4B;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACb;",
|
|
4
|
+
"sourcesContent": ["export const AUTOMATIC_SYNC_DESCRIPTION =\n \"This setup: check remote state once at startup in TUI/RPC. At shutdown, push all selected content only when sessions are included; reload skips that push. Saves apply to subsequent operations; a new check waits for the next session start. This does not enable startup transfer.\";\n\nexport const STARTUP_TRANSFER_DESCRIPTION =\n \"This setup: separate opt-in for one idle startup transfer in TUI/RPC. Requires an accepted baseline, matching remote included paths, and conditional or lease-protected publication (Git, verified WebDAV, or R2/S3 with verified conditional writes). May upload, replace, or remove selected files. Never reloads resources. Enabling applies next session start; opening Settings cancels pending work. Completed transfers are not undone.\";\n\nexport function startupTransferSummary(config: {\n automaticTransfer?: boolean;\n backend: { type: \"s3\" | \"git\" | \"webdav\" };\n}) {\n if (!config.automaticTransfer) return \"Off\";\n return config.backend.type === \"s3\"\n ? \"On (next idle startup; R2/S3 conditional-write verification required)\"\n : \"On (next idle startup; baseline and remote policy checks required)\";\n}\n", "import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { AUTOMATIC_SYNC_DESCRIPTION, STARTUP_TRANSFER_DESCRIPTION } from \"../ui/sync-behavior.js\";\nimport type { CommandArgumentCompletion, CommandOptions } from \"./command-types.js\";\n\nconst YES_FLAG_COMPLETIONS: readonly CommandArgumentCompletion[] = [\n { value: \"--yes\", label: \"--yes\", description: \"Skip confirmation prompts\" },\n { value: \"-y\", label: \"-y\", description: \"Skip confirmation prompts\" },\n];\nexport const SYNC_COMMANDS = [\n { name: \"help\", description: \"Show command usage\" },\n { name: \"use\", description: \"Switch the current sync setup\", usageSuffix: \" <setup>\" },\n { name: \"init\", description: \"Create local config template\" },\n { name: \"config\", description: \"Show resolved configuration\" },\n { name: \"files\", description: \"Choose included content\" },\n { name: \"status\", description: \"Show sync status\" },\n { name: \"diff\", description: \"Show local/remote diff\" },\n { name: \"conflicts\", description: \"Review private unresolved conflict groups\" },\n { name: \"doctor\", description: \"Check config, secrets, and lock state\" },\n {\n name: \"daemon\",\n description: \"Review service handover and unattended permission\",\n usageSuffix: \" [status|recover|handover|allow-after-exit|revoke-after-exit]\",\n },\n { name: \"push\", description: \"Upload local settings\" },\n { name: \"pull\", description: \"Apply remote settings\" },\n { name: \"sync\", description: \"Push or pull as needed\" },\n { name: \"history\", description: \"Show recent remote snapshots\" },\n { name: \"rollback\", description: \"Apply a previous snapshot\", usageSuffix: \" <snapshot>\" },\n { name: \"migrate-state\", description: \"Move legacy state into pi-sync/\" },\n { name: \"unlock\", description: \"Remove a stale local lock\", usageSuffix: \" --stale\" },\n] as const;\n\nexport type SyncCommandName = (typeof SYNC_COMMANDS)[number][\"name\"];\n\nconst SYNC_COMMAND_COMPLETIONS: readonly CommandArgumentCompletion[] = SYNC_COMMANDS.map(({ name, description }) => ({\n value: name,\n label: name,\n description,\n}));\nlet setupCompletionNames: string[] = [];\n\nexport function setSyncSetupCompletions(names: readonly string[]) {\n setupCompletionNames = [...new Set(names)].sort((left, right) => left.localeCompare(right));\n}\nconst SETUP_FLAG_COMPLETION = {\n value: \"--setup\",\n label: \"--setup\",\n description: \"Address a sync setup without switching\",\n} as const;\nconst SYNC_FLAG_COMPLETIONS: Record<string, readonly CommandArgumentCompletion[]> = {\n config: [SETUP_FLAG_COMPLETION],\n files: [SETUP_FLAG_COMPLETION],\n status: [SETUP_FLAG_COMPLETION],\n diff: [SETUP_FLAG_COMPLETION],\n conflicts: [SETUP_FLAG_COMPLETION],\n doctor: [SETUP_FLAG_COMPLETION],\n push: [\n ...YES_FLAG_COMPLETIONS,\n { value: \"--force\", label: \"--force\", description: \"Overwrite visible remote changes\" },\n SETUP_FLAG_COMPLETION,\n ],\n pull: [\n ...YES_FLAG_COMPLETIONS,\n { value: \"--force\", label: \"--force\", description: \"Overwrite local changes\" },\n SETUP_FLAG_COMPLETION,\n ],\n sync: [\n ...YES_FLAG_COMPLETIONS,\n { value: \"--force\", label: \"--force\", description: \"Resolve conflicts by forcing action\" },\n SETUP_FLAG_COMPLETION,\n ],\n history: [SETUP_FLAG_COMPLETION],\n rollback: [...YES_FLAG_COMPLETIONS, SETUP_FLAG_COMPLETION],\n \"migrate-state\": YES_FLAG_COMPLETIONS,\n unlock: [{ value: \"--stale\", label: \"--stale\", description: \"Remove only a stale lock\" }],\n};\n\nexport function splitArgs(input: string) {\n return input.match(/(?:[^\\s\"']+|\"[^\"]*\"|'[^']*')+/g)?.map((arg) => arg.replace(/^['\"]|['\"]$/g, \"\")) ?? [];\n}\n\nexport function parseOptions(args: string[]): CommandOptions {\n const values: string[] = [];\n let yes = false;\n let force = false;\n let stale = false;\n let setup: string | undefined;\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n if (arg === \"--yes\" || arg === \"-y\") yes = true;\n else if (arg === \"--force\") force = true;\n else if (arg === \"--stale\") stale = true;\n else if (arg === \"--setup\") {\n const name = args[index + 1];\n if (!name || name.startsWith(\"-\")) throw new Error(\"--setup requires a sync setup name.\");\n if (setup !== undefined) throw new Error(\"--setup may be provided only once.\");\n setup = name;\n index += 1;\n } else if (arg.startsWith(\"-\")) {\n throw new Error(`Unknown sync option: ${arg}`);\n } else values.push(arg);\n }\n return {\n yes,\n force,\n stale,\n silent: false,\n reload: true,\n auto: false,\n ...(setup === undefined ? {} : { setup }),\n args: values,\n };\n}\n\nexport function validateCommandOptions(command: string, options: CommandOptions) {\n const setupAllowed = new Set([\n \"config\",\n \"files\",\n \"status\",\n \"diff\",\n \"conflicts\",\n \"doctor\",\n \"push\",\n \"pull\",\n \"sync\",\n \"history\",\n \"rollback\",\n ]);\n if (options.setup && !setupAllowed.has(command)) {\n throw new Error(`--setup is not supported by /sync ${command}.`);\n }\n if (options.yes && ![\"push\", \"pull\", \"sync\", \"rollback\", \"migrate-state\"].includes(command)) {\n throw new Error(`Confirmation/force options are not supported by /sync ${command}.`);\n }\n if (options.force && ![\"push\", \"pull\", \"sync\", \"rollback\"].includes(command)) {\n throw new Error(`Confirmation/force options are not supported by /sync ${command}.`);\n }\n if (options.stale && command !== \"unlock\") {\n throw new Error(`--stale is not supported by /sync ${command}.`);\n }\n if (command === \"daemon\" && options.args.length <= 1) {\n const action = options.args[0];\n if (action !== undefined && !DAEMON_ACTIONS.some((value) => value === action))\n throw new Error(`Unknown daemon action: ${action}`);\n return;\n }\n const expectedValues = command === \"rollback\" || command === \"use\" ? 1 : 0;\n if (options.args.length !== expectedValues) {\n if (command === \"rollback\") throw new Error(\"Usage: /sync rollback <snapshot-id> [--yes] [--setup <name>]\");\n if (command === \"use\") throw new Error(\"Usage: /sync use <setup>\");\n throw new Error(`Unexpected argument for /sync ${command}: ${options.args.join(\" \")}`);\n }\n}\n\nconst DAEMON_ACTIONS = [\"status\", \"recover\", \"handover\", \"allow-after-exit\", \"revoke-after-exit\"] as const;\n\nexport function completeSyncArguments(argumentPrefix: string): CommandArgumentCompletion[] | null {\n const prefix = argumentPrefix.trimStart();\n if (prefix === \"\") return [...SYNC_COMMAND_COMPLETIONS];\n\n const trailingSpace = /\\s$/.test(prefix);\n const tokens = splitArgs(prefix);\n if (tokens.length === 0) return [...SYNC_COMMAND_COMPLETIONS];\n\n const [command] = tokens;\n if (tokens.length === 1 && !trailingSpace) {\n const matches = SYNC_COMMAND_COMPLETIONS.filter((item) => item.value.startsWith(command));\n return matches.length > 0 ? [...matches] : null;\n }\n\n const args = tokens.slice(1);\n if (command === \"use\") {\n if (args.length > 1 || (trailingSpace && args.length > 0)) return null;\n return completeSetupValue(prefix, trailingSpace ? \"\" : (args[0] ?? \"\"));\n }\n if (command === \"daemon\") {\n if (args.length > 1 || (trailingSpace && args.length > 0)) return null;\n const current = trailingSpace ? \"\" : (args[0] ?? \"\");\n const base = trailingSpace ? prefix : prefix.slice(0, prefix.length - current.length);\n const matches = DAEMON_ACTIONS.filter((action) => action.startsWith(current));\n return matches.length\n ? matches.map((action) => ({ value: `${base}${action}`, label: action, description: \"Daemon control\" }))\n : null;\n }\n const setupFlagIndex = args.lastIndexOf(\"--setup\");\n if (setupFlagIndex >= 0 && setupFlagIndex === args.length - (trailingSpace ? 1 : 2)) {\n const currentSetup = trailingSpace ? \"\" : (args.at(-1) ?? \"\");\n if (!currentSetup.startsWith(\"-\")) return completeSetupValue(prefix, currentSetup);\n }\n\n const flagCompletions = SYNC_FLAG_COMPLETIONS[command];\n if (!flagCompletions) return null;\n\n const completedArgs = trailingSpace ? args : args.slice(0, -1);\n const completedValues = completedArgs.filter((arg) => !arg.startsWith(\"-\"));\n if (command === \"rollback\" ? completedValues.length > 1 : completedValues.length > 0) {\n return null;\n }\n\n const current = trailingSpace ? \"\" : (args.at(-1) ?? \"\");\n if (current && !current.startsWith(\"-\")) return null;\n\n const currentRaw = trailingSpace ? \"\" : (prefix.match(/\\S+$/)?.[0] ?? \"\");\n const completionPrefix = trailingSpace ? prefix : prefix.slice(0, prefix.length - currentRaw.length);\n const matches = flagCompletions.filter((item) => item.value.startsWith(current));\n return matches.length > 0 ? matches.map((item) => ({ ...item, value: `${completionPrefix}${item.value}` })) : null;\n}\n\nfunction completeSetupValue(prefix: string, current: string) {\n const currentRaw = current ? (prefix.match(/\\S+$/u)?.[0] ?? \"\") : \"\";\n const completionPrefix = currentRaw ? prefix.slice(0, prefix.length - currentRaw.length) : prefix;\n const matches = setupCompletionNames.filter((name) => name.startsWith(current));\n return matches.length > 0\n ? matches.map((name) => ({\n value: `${completionPrefix}${name}`,\n label: name,\n description: \"Sync setup\",\n }))\n : null;\n}\n\nexport function syncMenuOptions() {\n return SYNC_COMMANDS.map(({ name, description }) => `${name} \u2014 ${description}`);\n}\n\nexport function syncCommandFromMenuOption(option: string): SyncCommandName | undefined {\n return SYNC_COMMANDS.find(({ name, description }) => option === `${name} \u2014 ${description}`)?.name;\n}\n\nexport async function resolveSyncCommand(input: string, ctx: ExtensionCommandContext) {\n const [subcommand, ...rest] = splitArgs(input);\n if (subcommand) return { subcommand, rest };\n if (!ctx.hasUI) {\n ctx.ui.notify(usage(), \"info\");\n return undefined;\n }\n\n const selectedOption = await ctx.ui.select(\"pi-sync\", syncMenuOptions());\n const selected = selectedOption ? syncCommandFromMenuOption(selectedOption) : undefined;\n if (!selected) return undefined;\n if (selected !== \"rollback\") return { subcommand: selected, rest: [] };\n\n const target = (await ctx.ui.input(\"Rollback snapshot\", \"snapshot id\"))?.trim();\n if (!target) {\n ctx.ui.notify(\"Rollback cancelled.\", \"info\");\n return undefined;\n }\n return { subcommand: selected, rest: [target] };\n}\n\nexport function usage() {\n const commands = SYNC_COMMANDS.map(\n (command) => `${command.name}${\"usageSuffix\" in command ? command.usageSuffix : \"\"}`,\n ).join(\", \");\n return [\n \"Usage: /sync <command>\",\n `Commands: ${commands}`,\n \"In the /sync manager, Push to remote and Pull from remote use the chosen source and preserve a restore point without a second confirmation. Direct commands retain their existing review and flags.\",\n \"Daemon diagnostics: /sync daemon recover reviews and stops the existing daemon. It does not start a replacement or retry a transfer.\",\n `Automatic sync: ${AUTOMATIC_SYNC_DESCRIPTION}`,\n `Startup transfer: ${STARTUP_TRANSFER_DESCRIPTION}`,\n \"Automatic transfer at startup is a separate opt-in: one conflict-free established-baseline transfer at idle in TUI/RPC, with conditional/lease publication and no resource reload.\",\n \"Continuous sync is a separate default-Off opt-in in Settings. It requires Autonomous sync and can incur recurring network/model costs. After the last Pi exits, the service closes after a 30-second grace period unless a valid /sync daemon allow-after-exit grant applies. Zero-client work still requires that separate review. Safety blocks and durable automatic request limits remain.\",\n \"Settings: use /sync init or edit storage connections and sync setups in ~/.pi/agent/pi-sync.json (or the configured Pi agent directory). Version 1 and version 2 settings are unsupported and are never rewritten.\",\n ].join(\"\\n\");\n}\n"],
|
|
5
|
+
"mappings": ";;;;AAAO,IAAM,6BACX;AAEK,IAAM,+BACX;AAEK,SAAS,uBAAuB,QAGpC;AACD,MAAI,CAAC,OAAO,kBAAmB,QAAO;AACtC,SAAO,OAAO,QAAQ,SAAS,OAC3B,0EACA;AACN;;;ACVA,IAAM,uBAA6D;AAAA,EACjE,EAAE,OAAO,SAAS,OAAO,SAAS,aAAa,4BAA4B;AAAA,EAC3E,EAAE,OAAO,MAAM,OAAO,MAAM,aAAa,4BAA4B;AACvE;AACO,IAAM,gBAAgB;AAAA,EAC3B,EAAE,MAAM,QAAQ,aAAa,qBAAqB;AAAA,EAClD,EAAE,MAAM,OAAO,aAAa,iCAAiC,aAAa,WAAW;AAAA,EACrF,EAAE,MAAM,QAAQ,aAAa,+BAA+B;AAAA,EAC5D,EAAE,MAAM,UAAU,aAAa,8BAA8B;AAAA,EAC7D,EAAE,MAAM,SAAS,aAAa,0BAA0B;AAAA,EACxD,EAAE,MAAM,UAAU,aAAa,mBAAmB;AAAA,EAClD,EAAE,MAAM,QAAQ,aAAa,yBAAyB;AAAA,EACtD,EAAE,MAAM,aAAa,aAAa,4CAA4C;AAAA,EAC9E,EAAE,MAAM,UAAU,aAAa,wCAAwC;AAAA,EACvE;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,EACf;AAAA,EACA,EAAE,MAAM,QAAQ,aAAa,wBAAwB;AAAA,EACrD,EAAE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F,EAAE,KAAK,IAAI;AACb;",
|
|
6
6
|
"names": ["matches", "current"]
|
|
7
7
|
}
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
startupTransferSummary,
|
|
26
26
|
usage,
|
|
27
27
|
validateCommandOptions
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-XUZV4OGI.ts";
|
|
29
29
|
import {
|
|
30
30
|
manualIgnoreFileGuidance
|
|
31
31
|
} from "./chunk-EJDDRS6O.ts";
|
|
@@ -43,9 +43,10 @@ import {
|
|
|
43
43
|
syncSessionsWarnings
|
|
44
44
|
} from "./chunk-DAZZ5BEJ.ts";
|
|
45
45
|
import {
|
|
46
|
+
CompletedDirectionalRecoveryError,
|
|
46
47
|
piDaemonClient,
|
|
47
48
|
remoteOperation
|
|
48
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-JQ5BAWW2.ts";
|
|
49
50
|
import {
|
|
50
51
|
setSyncStatus
|
|
51
52
|
} from "./chunk-H7VOTY5N.ts";
|
|
@@ -102,12 +103,26 @@ async function executeRecoveryCommand(rawArgs, ctx, signal, loaders, onCommit, s
|
|
|
102
103
|
return { kind: "failed" };
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
|
-
async function executeCommand(rawArgs, ctx, signal, loaders, onCommit, setup, onDialog, retryRefusal = false) {
|
|
106
|
+
async function executeCommand(rawArgs, ctx, signal, loaders, onCommit, setup, onDialog, retryRefusal = false, directionalFingerprint) {
|
|
106
107
|
ctx = trackOperationDialogs(ctx, onDialog);
|
|
107
108
|
try {
|
|
109
|
+
const directionalClient = directionalFingerprint === void 0 ? void 0 : piDaemonClient(ctx);
|
|
108
110
|
const command = await resolveSyncCommand(rawArgs, ctx);
|
|
109
111
|
if (signal?.aborted || !command) return { kind: "completed" };
|
|
110
112
|
const { subcommand, rest } = command;
|
|
113
|
+
if (directionalClient && directionalFingerprint !== void 0) {
|
|
114
|
+
if (subcommand !== "push" && subcommand !== "pull" || rest.length || !setup || retryRefusal)
|
|
115
|
+
throw new Error("Invalid directional action.");
|
|
116
|
+
return await runDirectionalAction(
|
|
117
|
+
directionalClient,
|
|
118
|
+
ctx,
|
|
119
|
+
subcommand,
|
|
120
|
+
setup,
|
|
121
|
+
directionalFingerprint,
|
|
122
|
+
signal,
|
|
123
|
+
onCommit
|
|
124
|
+
);
|
|
125
|
+
}
|
|
111
126
|
const options = parseOptions(rest);
|
|
112
127
|
if (setup !== void 0) options.setup = setup;
|
|
113
128
|
if (signal) options.signal = signal;
|
|
@@ -193,7 +208,7 @@ ${guidance}`,
|
|
|
193
208
|
return { kind: "completed" };
|
|
194
209
|
}
|
|
195
210
|
case "conflicts": {
|
|
196
|
-
const { showConflicts } = await import("./conflict-review-
|
|
211
|
+
const { showConflicts } = await import("./conflict-review-J7L7S4AR.ts");
|
|
197
212
|
throwIfAborted(options.signal);
|
|
198
213
|
await showConflicts(ctx, options);
|
|
199
214
|
return { kind: "completed" };
|
|
@@ -249,6 +264,10 @@ ${usage()}`, "warning");
|
|
|
249
264
|
} catch (error) {
|
|
250
265
|
if (signal?.aborted) return { kind: "failed" };
|
|
251
266
|
setSyncStatus(ctx, void 0);
|
|
267
|
+
if (directionalFingerprint !== void 0) {
|
|
268
|
+
ctx.ui.notify(safeTerminalText(errorMessage(error)).slice(0, 1200), "error");
|
|
269
|
+
return { kind: "failed" };
|
|
270
|
+
}
|
|
252
271
|
if (error instanceof SetupPullRequiresUiError) throw error;
|
|
253
272
|
if (error instanceof RemoteSelectionMismatchError) {
|
|
254
273
|
return { kind: "remote-selection-required", decision: error.decision };
|
|
@@ -260,6 +279,25 @@ ${usage()}`, "warning");
|
|
|
260
279
|
return { kind: "failed" };
|
|
261
280
|
}
|
|
262
281
|
}
|
|
282
|
+
async function runDirectionalAction(client, ctx, direction, setup, fingerprint, signal, onCommit) {
|
|
283
|
+
try {
|
|
284
|
+
const result = await client.run(`${direction}.foreground`, { setup, fingerprint }, signal, ctx, onCommit);
|
|
285
|
+
if (!client.canReportDirectionalResult() || signal?.aborted && result?.outcome !== "applied")
|
|
286
|
+
return { kind: "failed" };
|
|
287
|
+
if (!result || result.outcome !== "applied" && result.outcome !== "cancelled" || result.message !== void 0 && typeof result.message !== "string") {
|
|
288
|
+
throw new Error("Invalid result from directional synchronization.");
|
|
289
|
+
}
|
|
290
|
+
if (result.message) ctx.ui.notify(safeTerminalText(result.message), "info");
|
|
291
|
+
return signal?.aborted ? { kind: "failed" } : { kind: "completed", outcome: result.outcome };
|
|
292
|
+
} catch (error) {
|
|
293
|
+
const completed = error instanceof CompletedDirectionalRecoveryError;
|
|
294
|
+
if (!client.canReportDirectionalResult() || signal?.aborted && !completed) return { kind: "failed" };
|
|
295
|
+
if (!signal?.aborted) setSyncStatus(ctx, void 0);
|
|
296
|
+
const message = safeTerminalText(errorMessage(error));
|
|
297
|
+
ctx.ui.notify(completed ? message : message.slice(0, 1200), "error");
|
|
298
|
+
return { kind: "failed" };
|
|
299
|
+
}
|
|
300
|
+
}
|
|
263
301
|
async function migrateStateDirectory(ctx, options) {
|
|
264
302
|
const result = await remoteOperation(ctx, "migrate-state", options);
|
|
265
303
|
throwIfAborted(options.signal);
|
|
@@ -279,7 +317,7 @@ async function initConfig(ctx, signal) {
|
|
|
279
317
|
return;
|
|
280
318
|
}
|
|
281
319
|
if (ctx.mode === "tui") {
|
|
282
|
-
const { showSetupWizard } = await import("./setup-wizard-
|
|
320
|
+
const { showSetupWizard } = await import("./setup-wizard-YP2KF2WQ.ts");
|
|
283
321
|
throwIfAborted(signal);
|
|
284
322
|
await showSetupWizard(ctx, signal);
|
|
285
323
|
return;
|
|
@@ -385,7 +423,7 @@ async function handleCommand(rawArgs, ctx, sessionSignal, loaders, attention, on
|
|
|
385
423
|
}
|
|
386
424
|
if (!needsDaemonRecovery?.()) await reconcileObservation(attention, sessionSignal);
|
|
387
425
|
if (sessionSignal.aborted) return;
|
|
388
|
-
const run = (route, signal, onCommit, target, onDialog, retryRefusal = false) => {
|
|
426
|
+
const run = (route, signal, onCommit, target, onDialog, retryRefusal = false, directionalFingerprint) => {
|
|
389
427
|
const [command, ...args2] = splitArgs(route);
|
|
390
428
|
if (command === "sync" && !retryRefusal) {
|
|
391
429
|
try {
|
|
@@ -403,13 +441,14 @@ async function handleCommand(rawArgs, ctx, sessionSignal, loaders, attention, on
|
|
|
403
441
|
observationCommitCallback(attention, sessionSignal, onCommit),
|
|
404
442
|
target,
|
|
405
443
|
onDialog,
|
|
406
|
-
retryRefusal
|
|
444
|
+
retryRefusal,
|
|
445
|
+
directionalFingerprint
|
|
407
446
|
);
|
|
408
447
|
};
|
|
409
448
|
if (!rawArgs.trim()) {
|
|
410
449
|
attention.expand();
|
|
411
450
|
try {
|
|
412
|
-
const { showSyncManager } = await import("./manager-ui-
|
|
451
|
+
const { showSyncManager } = await import("./manager-ui-RGA26Z6G.ts");
|
|
413
452
|
if (sessionSignal.aborted) return;
|
|
414
453
|
await showSyncManager(ctx, run, sessionSignal, {
|
|
415
454
|
needsDaemonRecovery,
|
|
@@ -512,7 +551,7 @@ function directSelectionOrigin(rawArgs) {
|
|
|
512
551
|
async function resolveSelectionAttention(ctx, attention, signal, loaders, options = {}) {
|
|
513
552
|
const current = attention.current();
|
|
514
553
|
if (!current || signal.aborted) return;
|
|
515
|
-
const { dispatchManagerResult } = await import("./manager-result-dispatcher-
|
|
554
|
+
const { dispatchManagerResult } = await import("./manager-result-dispatcher-XB75YLEG.ts");
|
|
516
555
|
if (signal.aborted || attention.current() !== current) return;
|
|
517
556
|
await dispatchManagerResult(
|
|
518
557
|
ctx,
|
|
@@ -543,4 +582,4 @@ export {
|
|
|
543
582
|
handleCommand,
|
|
544
583
|
resolveSelectionAttention
|
|
545
584
|
};
|
|
546
|
-
//# sourceMappingURL=command-handler-
|
|
585
|
+
//# sourceMappingURL=command-handler-YZ4DXQ7N.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/command-execution.ts", "../../src/commands/command-handler.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionCommandContext, ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { CompletedDirectionalRecoveryError } from \"../daemon/directional-recovery.js\";\nimport { type PiDaemonClient, piDaemonClient, remoteOperation } from \"../daemon/pi-client.js\";\nimport { loadSettingsConfig, sessionTokenWarnings, syncSessionsWarnings } from \"../settings/config.js\";\nimport { activeLocalConfigPath, createLocalConfigDocument, localConfigPath } from \"../settings/config-file.js\";\nimport { localConfigTemplate, readLocalConfigObject } from \"../settings/settings-store.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { throwIfAborted } from \"../sync/signals.js\";\nimport { syncErrorGuidance } from \"../sync/sync-error-guidance.js\";\nimport { errorMessage, isSyncDecisionRequiredError, SetupPullRequiresUiError } from \"../sync/sync-errors.js\";\nimport type { SyncLoaders } from \"../sync/sync-loaders.js\";\nimport { RemoteSelectionMismatchError, syncSessionsSelected } from \"../sync/sync-policy.js\";\nimport { automaticSyncSummary } from \"../ui/automatic-sync-summary.js\";\nimport type { RunRouteResult } from \"../ui/cancellable-operation.js\";\nimport { manualIgnoreFileGuidance } from \"../ui/ignore-file-guidance.js\";\nimport { trackOperationDialogs } from \"../ui/operation-dialogs.js\";\nimport { startupTransferSummary } from \"../ui/sync-behavior.js\";\nimport { setSyncStatus } from \"../ui/sync-status.js\";\nimport { safeTerminalText } from \"../ui/terminal-text.js\";\nimport { parseOptions, resolveSyncCommand, splitArgs, usage, validateCommandOptions } from \"./command.js\";\nimport type { CommandOptions } from \"./command-types.js\";\n\nexport async function executeRecoveryCommand(\n rawArgs: string,\n ctx: ExtensionContext,\n signal: AbortSignal | undefined,\n loaders: SyncLoaders,\n onCommit?: () => void,\n setup?: string,\n): Promise<RunRouteResult> {\n try {\n const [subcommand, ...rest] = splitArgs(rawArgs);\n if (subcommand !== \"sync\" && subcommand !== \"pull\" && subcommand !== \"push\") {\n throw new Error(`Unsupported sync recovery route: ${subcommand ?? \"missing\"}`);\n }\n const options = parseOptions(rest);\n if (setup !== undefined) options.setup = setup;\n if (signal) options.signal = signal;\n if (onCommit) options.onCommit = onCommit;\n options.reload = false;\n options.auto = false;\n validateCommandOptions(subcommand, options);\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n if (subcommand === \"push\") {\n const outcome = await operations.push(ctx, options);\n return { kind: \"completed\", ...(outcome ? { outcome } : {}) };\n }\n if (subcommand === \"pull\") {\n const outcome = await operations.pull(ctx, options);\n return { kind: \"completed\", ...(outcome ? { outcome } : {}) };\n }\n await operations.syncBoth(ctx, options);\n return { kind: \"completed\" };\n } catch (error) {\n if (signal?.aborted) return { kind: \"failed\" };\n setSyncStatus(ctx, undefined);\n if (error instanceof RemoteSelectionMismatchError) {\n return { kind: \"remote-selection-required\", decision: error.decision };\n }\n if (isSyncDecisionRequiredError(error)) {\n return { kind: \"decision-required\", decision: error.decision };\n }\n ctx.ui.notify(syncErrorGuidance(error), \"error\");\n return { kind: \"failed\" };\n }\n}\n\nexport async function executeCommand(\n rawArgs: string,\n ctx: ExtensionCommandContext,\n signal: AbortSignal | undefined,\n loaders: SyncLoaders,\n onCommit?: () => void,\n setup?: string,\n onDialog?: (active: boolean) => void,\n retryRefusal = false,\n directionalFingerprint?: string,\n): Promise<RunRouteResult> {\n ctx = trackOperationDialogs(ctx, onDialog);\n try {\n const directionalClient = directionalFingerprint === undefined ? undefined : piDaemonClient(ctx);\n const command = await resolveSyncCommand(rawArgs, ctx);\n if (signal?.aborted || !command) return { kind: \"completed\" };\n const { subcommand, rest } = command;\n if (directionalClient && directionalFingerprint !== undefined) {\n if ((subcommand !== \"push\" && subcommand !== \"pull\") || rest.length || !setup || retryRefusal)\n throw new Error(\"Invalid directional action.\");\n return await runDirectionalAction(\n directionalClient,\n ctx,\n subcommand,\n setup,\n directionalFingerprint,\n signal,\n onCommit,\n );\n }\n const options = parseOptions(rest);\n if (setup !== undefined) options.setup = setup;\n if (signal) options.signal = signal;\n if (onCommit) options.onCommit = onCommit;\n validateCommandOptions(subcommand, options);\n if (retryRefusal) {\n if (subcommand !== \"sync\") throw new Error(\"A refused-model retry is available only for merged sync.\");\n options.agentRetryRefusal = true;\n }\n\n switch (subcommand) {\n case \"daemon\": {\n const client = piDaemonClient(ctx);\n const action = options.args[0] ?? \"status\";\n if (action === \"recover\") {\n if (rest.length !== 1) throw new Error(\"Usage: /sync daemon recover\");\n const { recoverDaemonOwnership } = await import(\"../daemon/ownership-recovery.js\");\n await recoverDaemonOwnership(ctx, client, signal);\n } else if (action === \"handover\") {\n await client.run(\"daemon.handover\", {}, options.signal);\n } else if (action === \"allow-after-exit\" || action === \"revoke-after-exit\") {\n await client.run(\"daemon.handover\", {}, options.signal);\n const policy = (await client.run(\"daemon.policy\", {}, options.signal)) as { fingerprint: string };\n await client.run(\n \"daemon.authorize\",\n { fingerprint: policy.fingerprint, afterExit: action === \"allow-after-exit\" },\n options.signal,\n );\n } else if (action === \"status\") {\n const connection = await client.verifyConnection(options.signal);\n const guidance = client.ownershipCleanupRequired\n ? \"Use /sync daemon recover to review and stop the daemon.\"\n : \"Use pi-sync-daemon status/stop/restart --root <agent-directory> for explicit lifecycle control.\";\n const state = client.ownershipCleanupRequired ? \"connected; recovery required\" : \"connected\";\n ctx.ui.notify(\n `pi-sync-daemon: ${state}\\nPID: ${connection.identity.pid}\\nInstance: ${connection.identity.instance}\\n${guidance}`,\n \"info\",\n );\n } else throw new Error(\"Use /sync daemon status|recover|handover|allow-after-exit|revoke-after-exit.\");\n return { kind: \"completed\" };\n }\n case \"help\":\n ctx.ui.notify(usage(), \"info\");\n return { kind: \"completed\" };\n case \"use\": {\n const { useSyncSetup } = await loaders.setupSwitch();\n throwIfAborted(options.signal);\n await useSyncSetup(\n ctx,\n options.args[0] ?? \"\",\n async (selectedSetup) => {\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n return operations.pull(ctx, { ...options, setup: selectedSetup });\n },\n undefined,\n options.signal,\n );\n return { kind: \"completed\" };\n }\n case \"init\":\n await initConfig(ctx, signal);\n return { kind: \"completed\" };\n case \"config\":\n await showConfig(ctx, options);\n return { kind: \"completed\" };\n case \"files\": {\n const { showFileSelection } = await import(\"../ui/file-selection.js\");\n throwIfAborted(options.signal);\n await showFileSelection(ctx, options.setup, options.signal);\n return { kind: \"completed\" };\n }\n case \"status\": {\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n await operations.status(ctx, options);\n return { kind: \"completed\" };\n }\n case \"diff\": {\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n await operations.diff(ctx, options);\n return { kind: \"completed\" };\n }\n case \"conflicts\": {\n const { showConflicts } = await import(\"../sync/conflict-review.js\");\n throwIfAborted(options.signal);\n await showConflicts(ctx, options);\n return { kind: \"completed\" };\n }\n case \"doctor\": {\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n await operations.doctor(ctx, options);\n return { kind: \"completed\" };\n }\n case \"push\": {\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n const outcome = await operations.push(ctx, options);\n return { kind: \"completed\", ...(outcome ? { outcome } : {}) };\n }\n case \"pull\": {\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n const outcome = await operations.pull(ctx, options);\n return { kind: \"completed\", ...(outcome ? { outcome } : {}) };\n }\n case \"sync\": {\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n const outcome = await operations.syncBoth(ctx, options);\n return { kind: \"completed\", ...(retryRefusal && outcome && outcome !== \"archived\" ? { outcome } : {}) };\n }\n case \"history\": {\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n await operations.history(ctx, options);\n return { kind: \"completed\" };\n }\n case \"rollback\": {\n const operations = await loaders.operations();\n throwIfAborted(options.signal);\n await operations.rollback(ctx, options);\n return { kind: \"completed\" };\n }\n case \"migrate-state\":\n await migrateStateDirectory(ctx, options);\n return { kind: \"completed\" };\n case \"unlock\":\n await remoteOperation(ctx, \"unlock\", options);\n return { kind: \"completed\" };\n default:\n ctx.ui.notify(`Unknown /sync command: ${subcommand}\\n\\n${usage()}`, \"warning\");\n return { kind: \"failed\" };\n }\n } catch (error) {\n if (signal?.aborted) return { kind: \"failed\" };\n setSyncStatus(ctx, undefined);\n if (directionalFingerprint !== undefined) {\n ctx.ui.notify(safeTerminalText(errorMessage(error)).slice(0, 1200), \"error\");\n return { kind: \"failed\" };\n }\n if (error instanceof SetupPullRequiresUiError) throw error;\n if (error instanceof RemoteSelectionMismatchError) {\n return { kind: \"remote-selection-required\", decision: error.decision };\n }\n if (isSyncDecisionRequiredError(error)) {\n return { kind: \"decision-required\", decision: error.decision };\n }\n ctx.ui.notify(syncErrorGuidance(error), \"error\");\n return { kind: \"failed\" };\n }\n}\n\nasync function runDirectionalAction(\n client: PiDaemonClient,\n ctx: ExtensionCommandContext,\n direction: \"push\" | \"pull\",\n setup: string,\n fingerprint: string,\n signal: AbortSignal | undefined,\n onCommit: (() => void) | undefined,\n): Promise<RunRouteResult> {\n try {\n const result = (await client.run(`${direction}.foreground`, { setup, fingerprint }, signal, ctx, onCommit)) as\n | { outcome?: \"applied\" | \"cancelled\"; message?: string }\n | undefined;\n if (!client.canReportDirectionalResult() || (signal?.aborted && result?.outcome !== \"applied\"))\n return { kind: \"failed\" };\n if (\n !result ||\n (result.outcome !== \"applied\" && result.outcome !== \"cancelled\") ||\n (result.message !== undefined && typeof result.message !== \"string\")\n ) {\n throw new Error(\"Invalid result from directional synchronization.\");\n }\n if (result.message) ctx.ui.notify(safeTerminalText(result.message), \"info\");\n return signal?.aborted ? { kind: \"failed\" } : { kind: \"completed\", outcome: result.outcome };\n } catch (error) {\n const completed = error instanceof CompletedDirectionalRecoveryError;\n if (!client.canReportDirectionalResult() || (signal?.aborted && !completed)) return { kind: \"failed\" };\n if (!signal?.aborted) setSyncStatus(ctx, undefined);\n const message = safeTerminalText(errorMessage(error));\n ctx.ui.notify(completed ? message : message.slice(0, 1200), \"error\");\n return { kind: \"failed\" };\n }\n}\n\nasync function migrateStateDirectory(ctx: ExtensionCommandContext, options: CommandOptions) {\n const result = (await remoteOperation(ctx, \"migrate-state\", options)) as\n | { status: string; message?: string }\n | undefined;\n throwIfAborted(options.signal);\n ctx.ui.notify(\n result?.message ?? \"pi-sync already uses the canonical pi-sync/ state directory.\",\n result?.status === \"deferred\" ? \"warning\" : \"info\",\n );\n}\n\nasync function initConfig(ctx: ExtensionCommandContext, signal?: AbortSignal) {\n const configPath = localConfigPath();\n const existing = await readLocalConfigObject();\n throwIfAborted(signal);\n if (existing) {\n const activePath = await activeLocalConfigPath();\n throwIfAborted(signal);\n ctx.ui.notify(`Config already exists: ${activePath}`, \"info\");\n return;\n }\n\n if (ctx.mode === \"tui\") {\n const { showSetupWizard } = await import(\"../ui/setup/setup-wizard.js\");\n throwIfAborted(signal);\n await showSetupWizard(ctx, signal);\n return;\n }\n await createLocalConfigDocument(localConfigTemplate(), signal);\n throwIfAborted(signal);\n ctx.ui.notify(`Created ${configPath}. Add a storage connection and sync setup before syncing.`, \"info\");\n}\n\nasync function showConfig(ctx: ExtensionCommandContext, options: CommandOptions) {\n const config = await loadSettingsConfig(options.setup);\n throwIfAborted(options.signal);\n const warnings = [\n ...(config.backend.type === \"s3\" ? sessionTokenWarnings(config.backend.profile) : []),\n ...syncSessionsWarnings(config),\n ];\n const storageLines = configStorageLines(config);\n ctx.ui.notify(\n [\n \"pi-sync config:\",\n `sync setup: ${config.setupName}`,\n `storage connection: ${config.connectionName}`,\n ...storageLines,\n `storage path: ${config.storagePath}`,\n `automatic sync: ${automaticSyncSummary(config.automatic)}`,\n `settings field merge: ${config.mergeSettings ? \"On\" : \"Off\"}`,\n `machine-local settings.json fields: ${(config.localFields ?? []).map(safeTerminalText).join(\", \") || \"none\"}`,\n `startup transfer: ${startupTransferSummary(config)}`,\n `autonomous sync: ${config.agentMode ? \"On\" : \"Off\"}`,\n `continuous sync: ${config.continuous ? (config.agentMode ? \"On\" : \"paused; Autonomous sync is Off\") : \"Off\"}`,\n config.scope ? \"sync scope: Pi agent directory\" : `included content: ${config.include.join(\", \") || \"none\"}`,\n ...(config.pathPolicy === \"ignore-file\"\n ? [\"path policy: local ignore file\", manualIgnoreFileGuidance(config.ignoreFile ?? \".syncignore\")]\n : config.scope\n ? [\n `excluded paths: ${config.exclude?.map(safeTerminalText).join(\", \") || \"none\"}`,\n `re-included paths: ${config.reinclude?.map(safeTerminalText).join(\", \") || \"none\"}`,\n ]\n : []),\n `sessions: ${syncSessionsSelected(config) ? \"included\" : \"not included\"}`,\n `settings file: ${localConfigPath()}`,\n ...warnings,\n ].join(\"\\n\"),\n warnings.length > 0 ? \"warning\" : \"info\",\n );\n}\n\nfunction configStorageLines(config: AnySyncConfig) {\n switch (config.backend.type) {\n case \"git\":\n return [\n \"kind: git\",\n `remote: ${displayGitRemote(config.backend.profile.remote)}`,\n \"authentication: existing Git/SSH credentials (not stored)\",\n `branch: ${config.backend.destination.branch}`,\n ];\n case \"webdav\":\n return [\n \"kind: webdav\",\n `url: ${displayWebDavUrl(config.backend.profile.url, config.backend.profile.username)}`,\n \"username: configured (value hidden)\",\n \"password: configured\",\n ];\n case \"s3\":\n return [\n \"kind: s3\",\n `endpoint: ${config.backend.profile.endpoint}`,\n `bucket: ${config.backend.destination.bucket}`,\n `region: ${config.backend.profile.region}`,\n \"access key id: configured\",\n \"secret access key: configured\",\n `session token: ${config.backend.profile.sessionToken ? \"configured\" : \"not configured\"}`,\n ];\n }\n}\n\nfunction displayGitRemote(value: string | undefined) {\n if (!value) return \"missing\";\n try {\n const url = new URL(value);\n url.username = \"\";\n url.password = \"\";\n url.search = \"\";\n url.hash = \"\";\n return url.toString();\n } catch {\n return value.replace(/^(?:[^@\\s]+@)?(?<host>[^:]+):.+$/u, \"$<host>:\u2026\");\n }\n}\n\nfunction displayWebDavUrl(value: string | undefined, username: string | undefined) {\n if (!value) return \"missing\";\n try {\n const url = new URL(value);\n url.username = \"\";\n url.password = \"\";\n url.search = \"\";\n url.hash = \"\";\n return username ? `${url.origin}/\u2026` : `${url.origin}${url.pathname}`;\n } catch {\n return \"invalid (value hidden)\";\n }\n}\n", "import type { ExtensionCommandContext, ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { loadConfig } from \"../settings/config.js\";\nimport { readStateForConfig, syncStateFingerprint } from \"../state/sync-state-store.js\";\nimport { combineSignals } from \"../sync/signals.js\";\nimport { errorMessage } from \"../sync/sync-errors.js\";\nimport type { SyncLoaders } from \"../sync/sync-loaders.js\";\nimport { formatRemoteSelectionMismatch } from \"../sync/sync-policy.js\";\nimport type { RunRouteResult } from \"../ui/cancellable-operation.js\";\nimport {\n observationMatchesConfig,\n type SyncAttentionController,\n type SyncAttentionOrigin,\n syncAttentionMatchesConfig,\n} from \"../ui/sync-attention.js\";\nimport { setSyncStatus } from \"../ui/sync-status.js\";\nimport { parseOptions, splitArgs, validateCommandOptions } from \"./command.js\";\nimport { executeCommand, executeRecoveryCommand } from \"./command-execution.js\";\n\nexport async function handleCommand(\n rawArgs: string,\n ctx: ExtensionCommandContext,\n sessionSignal: AbortSignal,\n loaders: SyncLoaders,\n attention: SyncAttentionController,\n onExplicitSync?: (setup?: string) => void,\n needsDaemonRecovery?: () => boolean,\n) {\n const args = splitArgs(rawArgs);\n if (args[0] === \"daemon\" && args[1] === \"recover\") {\n await executeCommand(rawArgs, ctx, sessionSignal, loaders);\n return;\n }\n if (!needsDaemonRecovery?.()) await reconcileObservation(attention, sessionSignal);\n if (sessionSignal.aborted) return;\n const run = (\n route: string,\n signal?: AbortSignal,\n onCommit?: () => void,\n target?: string,\n onDialog?: (active: boolean) => void,\n retryRefusal = false,\n directionalFingerprint?: string,\n ) => {\n const [command, ...args] = splitArgs(route);\n if (command === \"sync\" && !retryRefusal) {\n try {\n const options = parseOptions(args);\n validateCommandOptions(\"sync\", options);\n onExplicitSync?.(target ?? options.setup);\n } catch {\n /* Invalid routes do not request an automatic retry. */\n }\n }\n return executeCommand(\n route,\n ctx,\n combineSignals(sessionSignal, signal),\n loaders,\n observationCommitCallback(attention, sessionSignal, onCommit),\n target,\n onDialog,\n retryRefusal,\n directionalFingerprint,\n );\n };\n if (!rawArgs.trim()) {\n attention.expand();\n try {\n const { showSyncManager } = await import(\"../ui/manager-ui.js\");\n if (sessionSignal.aborted) return;\n await showSyncManager(ctx, run, sessionSignal, {\n needsDaemonRecovery,\n getAttention: () => attention.current(),\n getObservation: () => attention.observation(),\n onObservationInvalidated: () => attention.clearObservation(),\n onSelectionResolved: (expected) => {\n if (attention.current() === expected) attention.clear(ctx);\n },\n });\n } catch (error) {\n if (sessionSignal.aborted) return;\n setSyncStatus(ctx, undefined);\n ctx.ui.notify(errorMessage(error), \"error\");\n }\n if (sessionSignal.aborted || needsDaemonRecovery?.()) return;\n await reconcileObservation(attention, sessionSignal);\n if (!sessionSignal.aborted) await attention.publish(ctx, sessionSignal);\n return;\n }\n const result = await run(rawArgs);\n if (sessionSignal.aborted || needsDaemonRecovery?.()) return;\n if (result.kind === \"decision-required\") {\n ctx.ui.notify(result.decision.directMessage, \"error\");\n } else if (result.kind === \"remote-selection-required\") {\n const origin = directSelectionOrigin(rawArgs);\n if (origin) attention.set(result.decision, origin);\n const deterministic = splitArgs(rawArgs).some((arg) => arg === \"--yes\" || arg === \"-y\");\n if (origin && ctx.mode === \"tui\" && !deterministic) {\n await resolveSelectionAttention(ctx, attention, sessionSignal, loaders);\n } else {\n ctx.ui.notify(\n formatRemoteSelectionMismatch(\n result.decision.setupName,\n result.decision.localInclude,\n result.decision.remoteInclude,\n ),\n \"error\",\n );\n }\n }\n await clearAttentionAfterCompletedOperation(rawArgs, result, ctx, attention, sessionSignal);\n await reconcileSelectionAttention(ctx, attention, sessionSignal);\n await reconcileObservation(attention, sessionSignal);\n if (!sessionSignal.aborted) await attention.publish(ctx, sessionSignal);\n}\n\nfunction observationCommitCallback(\n attention: SyncAttentionController,\n sessionSignal: AbortSignal,\n onCommit?: () => void,\n) {\n const observed = attention.observation();\n return () => {\n // Opening or cancelling a review changes nothing. A commit may change data\n // even if later publication/baseline cleanup fails; never restore old hints.\n if (!sessionSignal.aborted && attention.observation() === observed) attention.clearObservation();\n onCommit?.();\n };\n}\n\nasync function reconcileObservation(attention: SyncAttentionController, signal: AbortSignal) {\n const observed = attention.observation();\n if (!observed || signal.aborted) return;\n try {\n const config = await loadConfig();\n if (signal.aborted || attention.observation() !== observed) return;\n if (!observationMatchesConfig(observed, config)) {\n attention.clearObservation();\n return;\n }\n const state = await readStateForConfig(config);\n if (signal.aborted || attention.observation() !== observed) return;\n if (syncStateFingerprint(state) !== observed.inspection.stateIdentity) attention.clearObservation();\n } catch {\n if (!signal.aborted && attention.observation() === observed) attention.clearObservation();\n }\n}\n\nasync function clearAttentionAfterCompletedOperation(\n rawArgs: string,\n result: RunRouteResult,\n ctx: ExtensionContext,\n attention: SyncAttentionController,\n signal: AbortSignal,\n) {\n if (result.kind !== \"completed\" || result.outcome === \"cancelled\" || signal.aborted) return;\n const [command, ...rest] = splitArgs(rawArgs);\n if (command !== \"sync\" && command !== \"pull\" && command !== \"push\") return;\n const current = attention.current();\n if (!current) return;\n try {\n const options = parseOptions(rest);\n const setupName = options.setup ?? (await loadConfig()).setupName;\n if (signal.aborted || attention.current() !== current) return;\n if (current.decision.setupName === setupName) attention.clear(ctx);\n } catch {\n // Attention reconciliation below owns malformed or concurrently changed settings.\n }\n}\n\nasync function reconcileSelectionAttention(\n ctx: ExtensionContext,\n attention: SyncAttentionController,\n signal: AbortSignal,\n) {\n const current = attention.current();\n if (!current || signal.aborted) return;\n try {\n const config = await loadConfig(current.decision.setupName);\n if (signal.aborted || attention.current() !== current) return;\n if (!syncAttentionMatchesConfig(current, config)) attention.clear(ctx);\n } catch {\n if (!signal.aborted && attention.current() === current) attention.clear(ctx);\n }\n}\n\nfunction directSelectionOrigin(rawArgs: string): SyncAttentionOrigin | undefined {\n const command = splitArgs(rawArgs)[0];\n return command === \"sync\" || command === \"pull\" || command === \"push\" ? command : undefined;\n}\n\nexport async function resolveSelectionAttention(\n ctx: ExtensionContext,\n attention: SyncAttentionController,\n signal: AbortSignal,\n loaders: SyncLoaders,\n options: {\n cancelLabel?: string;\n withStateAccess?: <T>(task: () => Promise<T>) => Promise<T>;\n } = {},\n) {\n const current = attention.current();\n if (!current || signal.aborted) return;\n const { dispatchManagerResult } = await import(\"../ui/manager-result-dispatcher.js\");\n if (signal.aborted || attention.current() !== current) return;\n await dispatchManagerResult(\n ctx,\n { kind: \"remote-selection-required\", decision: current.decision },\n current.origin,\n (route, actionSignal, onCommit, target) => {\n const execute = () =>\n executeRecoveryCommand(\n route,\n ctx,\n combineSignals(signal, actionSignal),\n loaders,\n observationCommitCallback(attention, signal, onCommit),\n target,\n );\n return options.withStateAccess ? options.withStateAccess(execute) : execute();\n },\n signal,\n {\n cancelLabel: options.cancelLabel,\n withStateAccess: options.withStateAccess,\n onSelectionResolved: () => {\n if (attention.current() === current) attention.clear(ctx);\n },\n },\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,eAAsB,uBACpB,SACA,KACA,QACA,SACA,UACA,OACyB;AACzB,MAAI;AACF,UAAM,CAAC,YAAY,GAAG,IAAI,IAAI,UAAU,OAAO;AAC/C,QAAI,eAAe,UAAU,eAAe,UAAU,eAAe,QAAQ;AAC3E,YAAM,IAAI,MAAM,oCAAoC,cAAc,SAAS,EAAE;AAAA,IAC/E;AACA,UAAM,UAAU,aAAa,IAAI;AACjC,QAAI,UAAU,OAAW,SAAQ,QAAQ;AACzC,QAAI,OAAQ,SAAQ,SAAS;AAC7B,QAAI,SAAU,SAAQ,WAAW;AACjC,YAAQ,SAAS;AACjB,YAAQ,OAAO;AACf,2BAAuB,YAAY,OAAO;AAC1C,UAAM,aAAa,MAAM,QAAQ,WAAW;AAC5C,mBAAe,QAAQ,MAAM;AAC7B,QAAI,eAAe,QAAQ;AACzB,YAAM,UAAU,MAAM,WAAW,KAAK,KAAK,OAAO;AAClD,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ACF,aAAO,QAAQ,kBAAkB,QAAQ,gBAAgB,OAAO,IAAI,QAAQ;AAAA,IAC9E;AAAA,IACA;AAAA,IACA;AAAA,MACE,aAAa,QAAQ;AAAA,MACrB,iBAAiB,QAAQ;AAAA,MACzB,qBAAqB,MAAM;AACzB,YAAI,UAAU,QAAQ,MAAM,QAAS,WAAU,MAAM,GAAG;AAAA,MAC1D;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["args"]
|
|
7
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
remoteOperation
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JQ5BAWW2.ts";
|
|
6
6
|
import "./chunk-H7VOTY5N.ts";
|
|
7
7
|
import "./chunk-6YKOHBSC.ts";
|
|
8
8
|
import "./chunk-R3SAMXB6.ts";
|
|
@@ -15,4 +15,4 @@ async function showConflicts(ctx, options) {
|
|
|
15
15
|
export {
|
|
16
16
|
showConflicts
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=conflict-review-
|
|
18
|
+
//# sourceMappingURL=conflict-review-J7L7S4AR.ts.map
|
package/dist/chunks/{manager-result-dispatcher-FKW55L7I.ts → manager-result-dispatcher-XB75YLEG.ts}
RENAMED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
dispatchManagerResult
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-IOM6E5FW.ts";
|
|
6
|
+
import "./chunk-OWEOZZZE.ts";
|
|
7
7
|
import "./chunk-UMPA5S7X.ts";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-AYGMIMCV.ts";
|
|
9
9
|
import "./chunk-NXWHPVXR.ts";
|
|
10
10
|
import "./chunk-GELYN4UC.ts";
|
|
11
11
|
import "./chunk-ZO52JM4H.ts";
|
|
@@ -17,4 +17,4 @@ import "./chunk-2JNFEZ3V.ts";
|
|
|
17
17
|
export {
|
|
18
18
|
dispatchManagerResult
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=manager-result-dispatcher-
|
|
20
|
+
//# sourceMappingURL=manager-result-dispatcher-XB75YLEG.ts.map
|
|
@@ -20,18 +20,18 @@ import {
|
|
|
20
20
|
showEditWebDavStorageProfile,
|
|
21
21
|
showEditWebDavTarget,
|
|
22
22
|
showIgnoreFileAction
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OBVJTKVY.ts";
|
|
24
24
|
import {
|
|
25
25
|
dispatchManagerResult
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-IOM6E5FW.ts";
|
|
27
|
+
import "./chunk-OWEOZZZE.ts";
|
|
28
28
|
import {
|
|
29
29
|
SETUP_SWITCH_ACTION_OPTIONS,
|
|
30
30
|
saveOnSwitch,
|
|
31
31
|
setupSwitchActionFromLabel,
|
|
32
32
|
setupSwitchActionLabel,
|
|
33
33
|
useSyncSetup
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-SZJOUVCL.ts";
|
|
35
35
|
import {
|
|
36
36
|
isCloudflareR2Endpoint,
|
|
37
37
|
normalizeS3Endpoint,
|
|
@@ -64,13 +64,13 @@ import {
|
|
|
64
64
|
AUTOMATIC_SYNC_DESCRIPTION,
|
|
65
65
|
STARTUP_TRANSFER_DESCRIPTION,
|
|
66
66
|
startupTransferSummary
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-XUZV4OGI.ts";
|
|
68
68
|
import {
|
|
69
69
|
confirmMergeReview
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-WJQ4TGN5.ts";
|
|
71
71
|
import {
|
|
72
72
|
runCancellableOperation
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-AYGMIMCV.ts";
|
|
74
74
|
import {
|
|
75
75
|
directoryScopeSummary,
|
|
76
76
|
showExcludedPaths
|
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
} from "./chunk-DAZZ5BEJ.ts";
|
|
113
113
|
import {
|
|
114
114
|
piDaemonClient
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-JQ5BAWW2.ts";
|
|
116
116
|
import {
|
|
117
117
|
configureSyncStatus
|
|
118
118
|
} from "./chunk-H7VOTY5N.ts";
|
|
@@ -221,7 +221,7 @@ function blockedSyncMenuItem(label, manager) {
|
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
223
|
async function showManagerAttention(ctx, attention, runRoute, signal, onSelectionResolved) {
|
|
224
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
224
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-WVMET5RI.ts");
|
|
225
225
|
if (signal?.aborted) return "close";
|
|
226
226
|
const review = await showRemoteSelectionReview(ctx, attention.decision.setupName, signal, void 0, {
|
|
227
227
|
decision: attention.decision,
|
|
@@ -540,8 +540,8 @@ function storageLocation(config) {
|
|
|
540
540
|
// src/ui/manager-state.ts
|
|
541
541
|
var MAIN_MENU_ACTIONS = [
|
|
542
542
|
"Sync now",
|
|
543
|
-
"Pull from remote
|
|
544
|
-
"Push to remote
|
|
543
|
+
"Pull from remote",
|
|
544
|
+
"Push to remote",
|
|
545
545
|
"View differences",
|
|
546
546
|
"Check remote status",
|
|
547
547
|
"Settings",
|
|
@@ -2048,7 +2048,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
2048
2048
|
"remote-include": async ({ state, signal: actionSignal }) => {
|
|
2049
2049
|
if (state.reservedIgnoreNames !== void 0 && !ignoreAvailable) return { kind: "rejected" };
|
|
2050
2050
|
const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
2051
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2051
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-WVMET5RI.ts");
|
|
2052
2052
|
if (reviewSignal.aborted) return { kind: "rejected" };
|
|
2053
2053
|
const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
|
|
2054
2054
|
origin: "settings",
|
|
@@ -2139,6 +2139,26 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2139
2139
|
return false;
|
|
2140
2140
|
}
|
|
2141
2141
|
};
|
|
2142
|
+
const directionalAction = async (direction, state, signal) => {
|
|
2143
|
+
const review = state.manager.configReview;
|
|
2144
|
+
if (!review) return { kind: "stay" };
|
|
2145
|
+
const result = await runCancellableOperation(
|
|
2146
|
+
ctx,
|
|
2147
|
+
direction === "push" ? "Pushing to remote\u2026" : "Pulling from remote\u2026",
|
|
2148
|
+
direction,
|
|
2149
|
+
runRoute,
|
|
2150
|
+
{
|
|
2151
|
+
commitAware: true,
|
|
2152
|
+
cancelledMessage: direction === "push" ? "Push cancellation requested." : "Pull cancellation requested.",
|
|
2153
|
+
target: review.setupName,
|
|
2154
|
+
directionalFingerprint: review.fingerprint,
|
|
2155
|
+
signal,
|
|
2156
|
+
isCurrent
|
|
2157
|
+
}
|
|
2158
|
+
);
|
|
2159
|
+
const done = result.kind === "closed" || result.kind === "completed" && result.outcome === "applied" || result.kind === "failed" && options.needsDaemonRecovery?.();
|
|
2160
|
+
return done ? { kind: "close" } : { kind: "stay" };
|
|
2161
|
+
};
|
|
2142
2162
|
const menuItems = (manager) => {
|
|
2143
2163
|
const attentionItems = attentionMainMenuItems(manager);
|
|
2144
2164
|
const managerItems = manager.actions.map((label) => blockedSyncMenuItem(label, manager) ?? syncMainMenuItem(label));
|
|
@@ -2184,7 +2204,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2184
2204
|
if (!attention) {
|
|
2185
2205
|
const observation = state.manager.observation;
|
|
2186
2206
|
if (!observation) return { kind: "stay" };
|
|
2187
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2207
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-WVMET5RI.ts");
|
|
2188
2208
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
2189
2209
|
const config = await loadConfig();
|
|
2190
2210
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
@@ -2260,26 +2280,8 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2260
2280
|
const result = await showSyncSettings(ctx, runRoute, signal, review?.setupName);
|
|
2261
2281
|
return { kind: result === "exit" ? "close" : "stay" };
|
|
2262
2282
|
},
|
|
2263
|
-
pull:
|
|
2264
|
-
|
|
2265
|
-
commitAware: true,
|
|
2266
|
-
cancelledMessage: "Pull check cancelled; no local files were changed.",
|
|
2267
|
-
target: state.manager.configReview?.setupName,
|
|
2268
|
-
signal: sessionSignal
|
|
2269
|
-
});
|
|
2270
|
-
const disposition = await dispatchManagerResult(ctx, result, "pull", runRoute, sessionSignal);
|
|
2271
|
-
return disposition.kind === "close" ? { kind: "close" } : { kind: "stay" };
|
|
2272
|
-
},
|
|
2273
|
-
push: async ({ state }) => {
|
|
2274
|
-
const result = await runCancellableOperation(ctx, "Preparing push preview\u2026", "push", runRoute, {
|
|
2275
|
-
commitAware: true,
|
|
2276
|
-
cancelledMessage: "Push preparation cancelled; no remote files were changed.",
|
|
2277
|
-
target: state.manager.configReview?.setupName,
|
|
2278
|
-
signal: sessionSignal
|
|
2279
|
-
});
|
|
2280
|
-
const disposition = await dispatchManagerResult(ctx, result, "push", runRoute, sessionSignal);
|
|
2281
|
-
return disposition.kind === "close" ? { kind: "close" } : { kind: "stay" };
|
|
2282
|
-
},
|
|
2283
|
+
pull: ({ state, signal }) => directionalAction("pull", state, signal),
|
|
2284
|
+
push: ({ state, signal }) => directionalAction("push", state, signal),
|
|
2283
2285
|
setups: async () => {
|
|
2284
2286
|
const result = await showSyncSetupManager(ctx, runRoute, sessionSignal);
|
|
2285
2287
|
return result === "exit" ? { kind: "close" } : { kind: "stay" };
|
|
@@ -2487,8 +2489,8 @@ function syncMainMenuItem(label) {
|
|
|
2487
2489
|
const actions = {
|
|
2488
2490
|
"Sync now": "sync",
|
|
2489
2491
|
"Retry refused model result\u2026": "retry-refusal",
|
|
2490
|
-
"Pull from remote
|
|
2491
|
-
"Push to remote
|
|
2492
|
+
"Pull from remote": "pull",
|
|
2493
|
+
"Push to remote": "push",
|
|
2492
2494
|
"View differences": "diff",
|
|
2493
2495
|
"Check remote status": "status",
|
|
2494
2496
|
"Switch sync setup": "switch",
|
|
@@ -2514,8 +2516,8 @@ function syncMainMenuItem(label) {
|
|
|
2514
2516
|
description: {
|
|
2515
2517
|
sync: "Merge changes on both sides.",
|
|
2516
2518
|
"retry-refusal": "Retry model; may incur costs.",
|
|
2517
|
-
pull: "Remote \u2192 this device.",
|
|
2518
|
-
push: "This device \u2192 remote
|
|
2519
|
+
pull: "Remote \u2192 this device; replaces conflicting local files.",
|
|
2520
|
+
push: "This device \u2192 remote; replaces conflicting remote files.",
|
|
2519
2521
|
diff: "Inspect changes; no transfer.",
|
|
2520
2522
|
status: "Check remote; no transfer.",
|
|
2521
2523
|
settings: "Change sync settings.",
|
|
@@ -2536,4 +2538,4 @@ function syncMainMenuItem(label) {
|
|
|
2536
2538
|
export {
|
|
2537
2539
|
showSyncManager
|
|
2538
2540
|
};
|
|
2539
|
-
//# sourceMappingURL=manager-ui-
|
|
2541
|
+
//# sourceMappingURL=manager-ui-RGA26Z6G.ts.map
|